graph LR
Pytest_Plugin_Integration["Pytest Plugin Integration"]
Xdist_Coordinator_Master_Process_["Xdist Coordinator (Master Process)"]
Xdist_Worker_Slave_Process_["Xdist Worker (Slave Process)"]
Test_Item_Scheduler["Test Item Scheduler"]
Inter_Process_Communication_IPC_Layer["Inter-Process Communication (IPC) Layer"]
Pytest_Plugin_Integration -- "Initializes Distributed Session" --> Xdist_Coordinator_Master_Process_
Xdist_Coordinator_Master_Process_ -- "Spawns & Manages Workers" --> Xdist_Worker_Slave_Process_
Xdist_Coordinator_Master_Process_ -- "Requests Test Distribution Strategy" --> Test_Item_Scheduler
Test_Item_Scheduler -- "Provides Test Item Batches" --> Xdist_Coordinator_Master_Process_
Xdist_Coordinator_Master_Process_ -- "Sends Commands / Receives Events" --> Inter_Process_Communication_IPC_Layer
Inter_Process_Communication_IPC_Layer -- "Receives Tests / Sends Results" --> Xdist_Worker_Slave_Process_
click Pytest_Plugin_Integration href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/pytest-xdist/Pytest_Plugin_Integration.md" "Details"
click Xdist_Coordinator_Master_Process_ href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/pytest-xdist/Xdist_Coordinator_Master_Process_.md" "Details"
click Xdist_Worker_Slave_Process_ href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/pytest-xdist/Xdist_Worker_Slave_Process_.md" "Details"
click Inter_Process_Communication_IPC_Layer href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/pytest-xdist/Inter_Process_Communication_IPC_Layer.md" "Details"
pytest-xdist extends pytest to enable distributed test execution. The architecture centers around a Pytest Plugin Integration that initializes a Xdist Coordinator (Master Process). This Coordinator manages multiple Xdist Worker (Slave Process) instances, distributing test items via a Test Item Scheduler and communicating through a robust Inter-Process Communication (IPC) Layer. This design ensures efficient parallel test execution and centralized result aggregation, optimizing for both performance and maintainability.
Pytest Plugin Integration [Expand]
The initial interface that hooks pytest-xdist into the core pytest framework. It handles command-line argument parsing, session configuration, and the initiation of the distributed test run.
Related Classes/Methods:
Xdist Coordinator (Master Process) [Expand]
The central orchestrator of the distributed test session. It manages worker lifecycles, distributes test items, and aggregates all results and events from the workers.
Related Classes/Methods:
xdist.dsession.DSession:32-452xdist.dsession.pytest_runtestloop:128-144xdist.workermanage.WorkerManager.setup_nodes:91-97xdist.workermanage.WorkerManager.sendcommand:383-386xdist.dsession.DSession.worker_testreport:326-330xdist.dsession.DSession.worker_collectreport:357-368xdist.dsession.DSession.worker_errordown:238-267xdist.workermanage.WorkerManager.process_from_remote:392-467
Xdist Worker (Slave Process) [Expand]
An independent process responsible for executing a subset of test items assigned by the Coordinator and reporting its results.
Related Classes/Methods:
xdist.remote.pytest_runtestloop:200-209xdist.remote.run_one_test:211-234xdist.remote.sendevent:124-126
A specialized sub-component within the Coordinator's domain that implements various strategies for efficiently distributing test items among worker nodes.
Related Classes/Methods:
xdist.scheduler.load.LoadScheduling:14-335xdist.scheduler.each.EachScheduling:13-152xdist.scheduler.loadfile.LoadFileScheduling:10-60xdist.scheduler.loadgroup.LoadGroupScheduling:10-59xdist.scheduler.loadscope.LoadScopeScheduling:15-438xdist.scheduler.worksteal.WorkStealScheduling
Inter-Process Communication (IPC) Layer [Expand]
The abstract communication channel facilitating data exchange (commands, test items, results, events) between the Coordinator and Worker processes.
Related Classes/Methods: