pytest-spec is a pytest plugin that transforms the standard test execution output into a clear, human-readable specification format, similar to RSpec or Mocha. It uses test names and docstrings to generate descriptive sentences about test behavior. The current version is 6.0.0, and it follows a release cadence tied to pytest and Python major version updates.
pip install pytest-specNo compatibility data collected yet for this library.
Create a test file (e.g., `test_example.py`) and simply run `pytest` from your terminal after installation. pytest-spec automatically modifies the output.
Upgrade your Python environment to 3.10 or newer. For example: `pyenv install 3.10.12 && pyenv local 3.10.12`.
Upgrade pytest to version 6.0.0 or newer. For example: `pip install 'pytest>=6.0.0,<10.0.0'`.
Add a clear, concise docstring to each test function or method explaining its purpose. Example: `def test_something(): """It should do X when Y."""`.
Run pytest with `pytest -p no:spec` to disable the plugin for that specific run. You can also add `addopts = -p no:spec` to your `pytest.ini` to disable it project-wide.
Run `pip install pytest-spec` to install the plugin.
Ensure `pytest-spec` is installed. Check your `pytest.ini` for `addopts = -p no:spec`. You can run `pytest --trace-config` to see which plugins are loaded. If conflicts exist, try disabling other plugins, e.g., `pytest -p no:another_plugin`.
Upgrade your pytest installation: `pip install 'pytest>=6.0.0,<10.0.0'`.