Registry / testing / pytest-hot-reloading

pytest-hot-reloading

JSON →
library0.1.0a19pypiunverified

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.

pip install pytest-hot-reloading
INSTALL
IMPORT
SIG · PYTEST-HOT-RELOADI
P
pytest-hot-reloading
testingenv0.1.0a19
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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.

# 1. Install the plugin # pip install pytest-hot-reloading # 2. Create a test file (e.g., test_example.py) # with the content: # def test_initial_check(): # assert True # 3. Run pytest normally from your terminal # pytest # 4. While pytest is running, modify test_example.py # For instance, change 'assert True' to 'assert False' and save. # The tests should automatically re-run and show the new result. # Change it back to 'assert True' and save to see it pass again.
pytest --version
Debug
Known issues
gotchaThis library is in an alpha stage (e.g., `0.1.0a19`). Expect potential API changes, instability, and incomplete documentation.
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`.
affects: <1.0.0
gotchaHot-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.
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.
affects: all
breakingThis 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.
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.
affects: 0.1.0a19
gotchaFile watching performance might be impacted in very large repositories, repositories with many rapidly changing files, or on certain network file systems.
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`.
affects: all
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'pytest_hot_reloading'
The `pytest-hot-reloading` package was not installed or installed in a different Python environment than the one running pytest.
fix
Ensure the plugin is installed in your active environment: `pip install pytest-hot-reloading`.
pytest is running but tests are not hot-reloading after file changes.
This usually indicates a pytest version incompatibility, a conflicting plugin, or an issue with the underlying file watcher.
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).
RuntimeError: The watchfiles library is not installed. Please install it with 'pip install watchfiles'.
`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).
fix
Manually install the missing dependency: `pip install watchfiles`. Also, ensure your `pip` is up to date (`pip install --upgrade pip`).
Upgrade
Version history
0.1.0a19latest on PyPI · released Sep 23, 2024
Audit
Dependencies
pytestrequiredCore testing framework; this is a plugin for it.
watchfilesrequiredUsed for efficient file system watching.
Agent activity
2 hits · last 30 days
node
2
Resources

No resource links recorded.

pytest-hot-reloading — pip install pytest-hot-reloading · libregistry