]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Fix concurrency test
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sat, 6 Mar 2021 02:08:54 +0000 (03:08 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sat, 6 Mar 2021 02:08:54 +0000 (03:08 +0100)
It was blocking because the committer was a too busy loop never yielding
to the other worker.

tests/test_concurrency_async.py

index a75e09f711bd6abfb0b3af953009d13d434fbe3d..c6fbe4c9010a905688c70165a7be123b386bd151 100644 (file)
@@ -9,7 +9,7 @@ pytestmark = pytest.mark.asyncio
 
 
 @pytest.mark.slow
-@pytest.mark.skip  # TODO: sometimes this test hangs?
+@pytest.mark.skip
 async def test_commit_concurrency(aconn):
     # Check the condition reported in psycopg2#103
     # Because of bad status check, we commit even when a commit is already on
@@ -24,6 +24,7 @@ async def test_commit_concurrency(aconn):
         nonlocal stop
         while not stop:
             await aconn.commit()
+            await asyncio.sleep(0)  # Allow the other worker to work
 
     async def runner():
         nonlocal stop