Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix env-var name for parallel tox tests #1112

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pytest_django/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions tests/test_db_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
"""
Expand Down Expand Up @@ -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(
"""
Expand Down Expand Up @@ -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(
"""
Expand Down
Loading