Test Overview
This test runs multiple test functions in parallel using pytest with the -n auto option. It verifies that all tests execute and pass concurrently, speeding up the test suite.
This test runs multiple test functions in parallel using pytest with the -n auto option. It verifies that all tests execute and pass concurrently, speeding up the test suite.
import pytest def test_addition(): assert 1 + 1 == 2 def test_subtraction(): assert 5 - 3 == 2 def test_multiplication(): assert 3 * 4 == 12 if __name__ == "__main__": pytest.main(["-n", "auto"])
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test runner starts with pytest and option '-n auto' to enable parallel execution | pytest initializes and detects 3 test functions in the file | - | PASS |
| 2 | pytest-xdist plugin creates worker processes equal to CPU cores available | Multiple worker processes ready to run tests in parallel | - | PASS |
| 3 | Each worker process runs one or more test functions concurrently | test_addition, test_subtraction, and test_multiplication executing in parallel | - | PASS |
| 4 | Assertions inside each test function are checked | Each test function completes and returns pass if assertion is true | assert 1 + 1 == 2, assert 5 - 3 == 2, assert 3 * 4 == 12 | PASS |
| 5 | pytest collects results from all workers and aggregates the test report | All tests passed, report shows 3 passed tests | All tests passed without errors | PASS |