{"id":4722,"library":"pytest-parallel","title":"pytest-parallel","description":"pytest-parallel is a pytest plugin that enables parallel and concurrent testing by utilizing both multiprocessing (workers) and multithreading (tests per worker). It is designed for specific use cases, such as Selenium tests, where tests can be thread-safe, benefit from non-blocking I/O, and manage minimal state in the Python environment. It is not intended as a direct replacement for pytest-xdist, which focuses solely on process-based parallelism for general test distribution. The current version is 0.1.1. The project appears to be unmaintained.","status":"abandoned","version":"0.1.1","language":"en","source_language":"en","source_url":"https://github.com/kevlened/pytest-parallel","tags":["pytest","testing","parallel","concurrency","selenium"],"install":[{"cmd":"pip install pytest-parallel","lang":"bash","label":"Install stable release"}],"dependencies":[{"reason":"Core testing framework that this plugin extends.","package":"pytest","optional":false}],"imports":[],"quickstart":{"code":"import time\nimport pytest\n\n# test_example.py\n\ndef test_fast_operation_1():\n    time.sleep(0.01)\n    assert True\n\ndef test_fast_operation_2():\n    time.sleep(0.01)\n    assert True\n\ndef test_fast_operation_3():\n    time.sleep(0.01)\n    assert True\n\ndef test_slow_operation_1():\n    time.sleep(0.1)\n    assert True\n\ndef test_slow_operation_2():\n    time.sleep(0.1)\n    assert True\n\n# Run with: pytest --workers 2 --tests-per-worker 2\n# This will execute tests using 2 processes, with each process running up to 2 tests concurrently.","lang":"python","description":"Create a test file (e.g., `test_example.py`) and then execute pytest from your terminal, specifying the number of workers (processes) and tests per worker (concurrent threads). This example demonstrates how to set up simple tests for parallel and concurrent execution."},"warnings":[{"fix":"Consider alternatives like pytest-xdist for general parallel execution, or thoroughly test pytest-parallel's compatibility with your specific pytest version before relying on it in production. Be aware that the `pytest-run-parallel` project (from Quansight-Labs) is a different, more actively maintained project with a similar goal, but distinct features.","message":"The pytest-parallel project (version 0.1.1) is explicitly marked as unmaintained on its GitHub repository. It relies on patching pytest internals, which can lead to instability or breakage with newer versions of pytest as the internal structure changes.","severity":"breaking","affected_versions":"0.1.1 and potentially future pytest versions"},{"fix":"Monitor for unexpected crashes or hangs in parallel test runs on macOS. You may need to investigate alternative multiprocessing start methods or adjust your test environment if issues arise, though direct control over this within `pytest-parallel` is not explicitly documented.","message":"Starting with Python 3.8 on macOS, forking behavior for multiprocessing is forced at the expense of safety, and `spawn` is the default start method. Using `pytest-parallel` (which leverages multiprocessing) on macOS with Python 3.8+ might expose subprocess stability issues due to this change.","severity":"gotcha","affected_versions":"0.1.1 on macOS with Python 3.8+"},{"fix":"Ensure all tests are atomic, independent, and properly isolated. Avoid shared mutable state between tests. If a test is not thread-safe, it should not be run concurrently. Consider marking such tests to run serially if your test suite design cannot guarantee thread safety.","message":"Parallel and concurrent testing with `pytest-parallel` requires careful test isolation. Tests that modify shared global state, rely on specific test ordering, or use non-thread-safe fixtures (e.g., `capsys`, `monkeypatch` as warned by similar plugins) will likely lead to flaky tests, unpredictable failures, or incorrect results.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Profile your test suite's execution time with and without `pytest-parallel`. Use it primarily for I/O-bound tests (like web requests in Selenium) that can genuinely benefit from concurrency and parallelization, rather than CPU-bound unit tests.","message":"While `pytest-parallel` enables concurrent execution, it's not a universal speedup solution. For test suites consisting of many very fast unit tests that don't involve I/O waits, the overhead of managing processes and threads can sometimes make parallel execution slower than sequential execution.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}