pytest-dev / pytest-dev/pytest-xdist

pytest-xdist --dist=loadscope mode does not group by class

Open
#753 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.9k
Forks
287
Avg merge
9h 30m
Merged PRs (30d)
2

Description

I have 2 remote servers and a master server, I send the test cases to those 2 remote servers with socket way and below is the test case ranning detail.

I want to group test cases by class and this class only runs on a remote server, so I use dist mode: loadscope, but I find that it does not work!

You can see below, the class TestStaffManagement ran by gw0 and gw1!!!

[gw1] FAILED test_cases/staff/test_department.py::TestDepartment::test_create_department
[gw1] SKIPPED test_cases/staff/test_department.py::TestDepartment::test_search_department
[gw1] SKIPPED test_cases/staff/test_staff.py::TestStaffManagement::test_search_staff
[gw0] FAILED test_cases/staff/test_staff.py::TestStaffManagement::test_create_staff
[gw1] FAILED test_cases/staff/test_staff.py::TestStaffManagement::test_export_staff
[gw0] PASSED test_cases/staff_group/test_staff_group2.py::TestStaffGroupManagement::test_default_UI
[gw1] PASSED test_cases/staff/test_staff.py::TestStaffManagement::test_create_staff_batch
[gw0] PASSED test_cases/staff/test_department.py::TestDepartment::test_default_UI

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the reported behavior with pytest-xdist using --dist=loadscope and the shown class-based tests. Start by tracing how loadscope assigns test nodes to workers, then compare the worker assignments with the expected class grouping. Done means every test from a class is scheduled on one remote worker.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
distributed-systems, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.