Parallel Execution with pytest -n
In Python, each parallel worker is a separate OS process, eliminating GIL (Global Interpreter Lock) contention:
# Run tests across 4 parallel processes:
pytest -n 4# Run with auto CPU detection:
pytest -n auto
Golden Rule of Parallelism
Never share browser instances or state across tests. Each test function must request a fresh browser fixture!