Fixture for TestArrayFields. Uses models defined in tests.testmodels_postgres module. Equivalent to: test.IsolatedTestCase with tortoise_test_modules=["tests.testmodels_postgres"]
()
| 15 | |
| 16 | @pytest_asyncio.fixture(scope="function") |
| 17 | async def db_array_fields(): |
| 18 | """ |
| 19 | Fixture for TestArrayFields. |
| 20 | |
| 21 | Uses models defined in tests.testmodels_postgres module. |
| 22 | Equivalent to: test.IsolatedTestCase with tortoise_test_modules=["tests.testmodels_postgres"] |
| 23 | """ |
| 24 | db_url = os.getenv("TORTOISE_TEST_DB", "sqlite://:memory:") |
| 25 | # Skip on non-Postgres databases since ArrayFields require Postgres |
| 26 | if "postgres" not in db_url: |
| 27 | pytest.skip("ArrayFields require PostgreSQL") |
| 28 | async with tortoise_test_context( |
| 29 | modules=["tests.testmodels_postgres"], |
| 30 | db_url=db_url, |
| 31 | app_label="models", |
| 32 | connection_label="models", |
| 33 | ) as ctx: |
| 34 | yield ctx |
| 35 | |
| 36 | |
| 37 | @pytest_asyncio.fixture(scope="function") |
nothing calls this directly
no test coverage detected
searching dependent graphs…