Skip to content

Commit

Permalink
;-(
Browse files Browse the repository at this point in the history
  • Loading branch information
manatlan committed Sep 8, 2023
1 parent 24817a8 commit e1d27f7
Showing 1 changed file with 23 additions and 33 deletions.
56 changes: 23 additions & 33 deletions test_sessions.py
Original file line number Diff line number Diff line change
@@ -1,40 +1,24 @@
import pytest,asyncio,sys
from htagweb.sessions import createFile, createFilePersistent, createShm, createMem

# @pytest.fixture( params=["createFile", "createFilePersistent"] )
# @pytest.fixture( params=["createFile", "createFilePersistent", "createMem"] )
# @pytest.fixture( params=["createFile", "createFilePersistent", "createShm", "createMem"] )
# def method_session(request):
# if request.param=="createFile":
# return createFile
# elif request.param=="createFilePersistent":
# return createFilePersistent
# elif request.param=="createShm":
# return createShm
# elif request.param=="createMem":
# from htagweb.sessions.memory import startServer
# assert asyncio.get_event_loop()
# startServer()
# return createMem


async def session_test(method_session):
session = await method_session("uid")
try:
session["nb"]=session.get("nb",0) + 1
session = await method_session("uid")
try:
session["nb"]=session.get("nb",0) + 1

# ensure persistance is present
session = await method_session("uid")
assert session["nb"]==1
# ensure persistance is present
session = await method_session("uid")
assert session["nb"]==1

assert len(session.items())>0
session.clear()
assert len(session.items())>0
session.clear()

session = await method_session("uid")
assert len(session.items())==0
session = await method_session("uid")
assert len(session.items())==0

finally:
session.clear()
finally:
session.clear()



Expand All @@ -46,12 +30,18 @@ async def test_sessions_file():
async def test_sessions_filepersitent():
await session_test( createFilePersistent )

# @pytest.mark.asyncio
# async def test_sessions_memory():
# from htagweb.sessions.memory import startServer,PX
# startServer()
#@pytest.mark.asyncio
# def test_sessions_memory():
# async def doit():
# from htagweb.sessions.memory import startServer,PX
# # startServer()
# PX.start_process()

# await session_test( createMem )

# PX.stop()

# await session_test( createMem )
# asyncio.run( doit())


@pytest.mark.asyncio
Expand Down

0 comments on commit e1d27f7

Please sign in to comment.