Test Overview
This test checks if the pytest-xdist plugin is installed correctly and can be used to run tests in parallel. It verifies that the plugin is available and that tests run with multiple workers.
This test checks if the pytest-xdist plugin is installed correctly and can be used to run tests in parallel. It verifies that the plugin is available and that tests run with multiple workers.
import pytest def test_sample(): assert 1 + 1 == 2 if __name__ == '__main__': # Run pytest with 2 workers using pytest-xdist import sys sys.exit(pytest.main(['-n', '2']))
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts by importing pytest and defining a simple test function | Python environment with pytest and pytest-xdist installed | - | PASS |
| 2 | Runs pytest with the '-n 2' option to use 2 parallel workers | pytest-xdist plugin is loaded and ready to distribute tests | pytest recognizes '-n 2' option and starts 2 workers | PASS |
| 3 | pytest discovers and runs the test_sample function with parallel workers | Two worker processes are started, one executes the test | test_sample passes | PASS |
| 4 | pytest completes test run and reports results | Test report shows 1 test passed with 2 workers | All tests passed with no errors | PASS |