{"id":14835,"library":"pytest-hot-reloading","title":"pytest-hot-reloading","description":"pytest-hot-reloading is a pytest plugin that enables hot-reloading of tests during development. It watches for changes in your project files and automatically re-runs affected tests, providing immediate feedback without restarting the pytest session. It is currently in an alpha stage, meaning its API and behavior may change. Releases are irregular due to its early development phase.","status":"active","version":"0.1.0a19","language":"en","source_language":"en","source_url":"https://github.com/pytest-dev/pytest-hot-reloading","tags":["pytest","testing","hot-reloading","development","plugin"],"install":[{"cmd":"pip install pytest-hot-reloading","lang":"bash","label":"Install latest alpha version"}],"dependencies":[{"reason":"Core testing framework; this is a plugin for it.","package":"pytest","optional":false},{"reason":"Used for efficient file system watching.","package":"watchfiles","optional":false}],"imports":[],"quickstart":{"code":"# 1. Install the plugin\n# pip install pytest-hot-reloading\n\n# 2. Create a test file (e.g., test_example.py)\n# with the content:\n# def test_initial_check():\n#     assert True\n\n# 3. Run pytest normally from your terminal\n# pytest\n\n# 4. While pytest is running, modify test_example.py\n# For instance, change 'assert True' to 'assert False' and save.\n# The tests should automatically re-run and show the new result.\n# Change it back to 'assert True' and save to see it pass again.","lang":"python","description":"Install the plugin and simply run pytest as you normally would. The plugin automatically detects changes in your project files and re-runs relevant tests without requiring you to manually restart the pytest command."},"warnings":[{"fix":"Regularly check the GitHub repository for updates and breaking changes. Pin your version in `requirements.txt` to avoid unexpected upgrades, e.g., `pytest-hot-reloading==0.1.0a19`.","message":"This library is in an alpha stage (e.g., `0.1.0a19`). Expect potential API changes, instability, and incomplete documentation.","severity":"gotcha","affected_versions":"<1.0.0"},{"fix":"If encountering unexpected behavior, try disabling `pytest-hot-reloading` (e.g., `pytest -p no:hot-reloading`) to determine if it's the cause. Consult the documentation for known incompatibilities.","message":"Hot-reloading can interfere with certain pytest fixtures or other pytest plugins that rely on a clean session state or complex setup/teardown processes, leading to unexpected test failures or behavior.","severity":"gotcha","affected_versions":"all"},{"fix":"Ensure your `pytest` version is within the supported range (`>=7.0, <9.0`). Upgrade `pytest-hot-reloading` when a version supporting `pytest 9.0+` is released.","message":"This version of `pytest-hot-reloading` (0.1.0a19) requires `pytest` versions between `7.0` (inclusive) and `9.0` (exclusive). It is incompatible with `pytest 9.0` and newer.","severity":"breaking","affected_versions":"0.1.0a19"},{"fix":"Consider adjusting the scope of files being watched if future configuration options become available. For critical tasks, temporarily disable the plugin using `pytest -p no:hot-reloading`.","message":"File watching performance might be impacted in very large repositories, repositories with many rapidly changing files, or on certain network file systems.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Ensure the plugin is installed in your active environment: `pip install pytest-hot-reloading`.","cause":"The `pytest-hot-reloading` package was not installed or installed in a different Python environment than the one running pytest.","error":"ModuleNotFoundError: No module named 'pytest_hot_reloading'"},{"fix":"First, verify your `pytest` version is compatible (see warnings). Check for other plugins that might interfere: `pytest --trace-config` or try disabling others with `pytest -p no:another-plugin`. Ensure your file system isn't causing issues (e.g., WSL, network drives might require specific configurations).","cause":"This usually indicates a pytest version incompatibility, a conflicting plugin, or an issue with the underlying file watcher.","error":"pytest is running but tests are not hot-reloading after file changes."},{"fix":"Manually install the missing dependency: `pip install watchfiles`. Also, ensure your `pip` is up to date (`pip install --upgrade pip`).","cause":"`watchfiles` is a required dependency that might not have been installed automatically (e.g., due to an older `pip` version or isolated build environment issues).","error":"RuntimeError: The watchfiles library is not installed. Please install it with 'pip install watchfiles'."}],"ecosystem":"pypi"}