diff --git a/tests/test_concurrency.py b/tests/test_concurrency.py index fd22d4d77..6bd05442e 100644 --- a/tests/test_concurrency.py +++ b/tests/test_concurrency.py @@ -3,7 +3,7 @@ from tests.testmodels import Tournament, UniqueName from tortoise.contrib import test -# from tortoise.contrib.test.condition import NotIn +from tortoise.contrib.test.condition import NotEQ from tortoise.transactions import in_transaction @@ -30,14 +30,14 @@ async def test_nonconcurrent_get_or_create(self): for una in unas: self.assertEqual(una[0], unas[0][0]) - # @test.skipIf(sys.version_info < (3, 7), "aiocontextvars backport not handling this well") - # @test.requireCapability(dialect=NotIn("mssql", "oracle")) - # async def test_concurrent_get_or_create(self): - # unas = await asyncio.gather(*[UniqueName.get_or_create(name="d") for _ in range(10)]) - # una_created = [una[1] for una in unas if una[1] is True] - # self.assertEqual(len(una_created), 1) - # for una in unas: - # self.assertEqual(una[0], unas[0][0]) + @test.skipIf(sys.version_info < (3, 7), "aiocontextvars backport not handling this well") + @test.requireCapability(dialect=NotEQ("mssql")) + async def test_concurrent_get_or_create(self): + unas = await asyncio.gather(*[UniqueName.get_or_create(name="d") for _ in range(10)]) + una_created = [una[1] for una in unas if una[1] is True] + self.assertEqual(len(una_created), 1) + for una in unas: + self.assertEqual(una[0], unas[0][0]) @test.skipIf(sys.version_info < (3, 7), "aiocontextvars backport not handling this well") @test.requireCapability(supports_transactions=True)