From d61527066a0aa43a1d3dbe28d0a846ce4bd1ae1f Mon Sep 17 00:00:00 2001 From: Charlie Denton Date: Fri, 9 Feb 2024 18:28:31 +0000 Subject: [PATCH] Fix env-var name for parallel tox tests When running tests in parallel, we need to add a suffix to Django DB names to avoid clashes. This previously used `TOX_PARALLEL_ENV`, but Tox no longer sets this environment variable. Tox does set an environment variable called `TOX_ENV_NAME`, which works for this purpose, so use that instead. --- pytest_django/fixtures.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytest_django/fixtures.py b/pytest_django/fixtures.py index b14c737a..51c5c0af 100644 --- a/pytest_django/fixtures.py +++ b/pytest_django/fixtures.py @@ -66,7 +66,7 @@ def django_db_modify_db_settings_tox_suffix() -> None: skip_if_no_django() - tox_environment = os.getenv("TOX_PARALLEL_ENV") + tox_environment = os.getenv("TOX_ENV_NAME") if tox_environment: # Put a suffix like _py27-django21 on tox workers _set_suffix_to_test_databases(suffix=tox_environment)