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) diff --git a/tests/test_db_setup.py b/tests/test_db_setup.py index 9d6f0cfe..10ad4df0 100644 --- a/tests/test_db_setup.py +++ b/tests/test_db_setup.py @@ -367,7 +367,7 @@ def test_db_with_tox_suffix( monkeypatch: pytest.MonkeyPatch, ) -> None: "A test to check that Tox DB suffix works when running in parallel." - monkeypatch.setenv("TOX_PARALLEL_ENV", "py37-django22") + monkeypatch.setenv("TOX_ENV_NAME", "py37-django22") django_pytester.create_test_module( """ @@ -395,7 +395,7 @@ def test_db_with_empty_tox_suffix( monkeypatch: pytest.MonkeyPatch, ) -> None: "A test to check that Tox DB suffix is not used when suffix would be empty." - monkeypatch.setenv("TOX_PARALLEL_ENV", "") + monkeypatch.setenv("TOX_ENV_NAME", "") django_pytester.create_test_module( """ @@ -434,7 +434,7 @@ def test_db_with_tox_suffix( ) -> None: "A test to check that both Tox and xdist suffixes work together." pytest.importorskip("xdist") - monkeypatch.setenv("TOX_PARALLEL_ENV", "py37-django22") + monkeypatch.setenv("TOX_ENV_NAME", "py37-django22") django_pytester.create_test_module( """