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

support pytest-xdist 2 #861

Merged
merged 1 commit into from
Aug 16, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion pytest_django/fixtures.py
Expand Up @@ -46,7 +46,7 @@ def django_db_modify_db_settings_tox_suffix():
def django_db_modify_db_settings_xdist_suffix(request):
skip_if_no_django()

xdist_suffix = getattr(request.config, "slaveinput", {}).get("slaveid")
xdist_suffix = getattr(request.config, "workerinput", {}).get("workerid")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't followed the slave/worker work, but is it safe to just switch, or should we keep compatibility with the old names for a while? I.e. like this:

Suggested change
xdist_suffix = getattr(request.config, "workerinput", {}).get("workerid")
workerinput = getattr(request.config, "workerinput", getattr(request.config, "slaveinput", {}))
xdist_suffix = workerinput.get("workerid", workerinput.get("slaveid"))

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pytest-cov switched wholesale, so I think pytest-django should too

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, looks like it should be fine from the graph provided in pytest-dev/pytest-cov#412 (comment).

if xdist_suffix:
# Put a suffix like _gw0, _gw1 etc on xdist processes
_set_suffix_to_test_databases(suffix=xdist_suffix)
Expand Down