{"id":10152,"library":"pytest-spec","title":"pytest-spec: Specification-style Test Output","description":"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.","status":"active","version":"6.0.0","language":"python","source_language":"en","source_url":"https://github.com/pchomik/pytest-spec","tags":["pytest","testing","spec","reporting","plugin"],"install":[{"cmd":"pip install pytest-spec","lang":"bash","label":"Install pytest-spec"}],"dependencies":[{"reason":"Required as it is a pytest plugin. Version 6.0.0+ is needed.","package":"pytest","optional":false}],"imports":[],"quickstart":{"code":"# test_example.py\nimport pytest\n\ndef test_feature_login_successful():\n    \"\"\"When valid credentials are provided, it should allow a user to log in successfully.\"\"\"\n    assert True\n\ndef test_feature_login_failed():\n    \"\"\"When invalid credentials are provided, it should deny access and show an error.\"\"\"\n    assert False\n\n@pytest.mark.parametrize(\"input, expected\", [(\"hello\", \"HELLO\"), (\"world\", \"WORLD\")])\ndef test_string_uppercase_conversion(input, expected):\n    \"\"\"It should correctly convert a given string to uppercase.\"\"\"\n    assert input.upper() == expected\n\n# To run these tests with pytest-spec, simply navigate to the directory\n# containing `test_example.py` in your terminal and run:\n# pytest","lang":"python","description":"Create a test file (e.g., `test_example.py`) and simply run `pytest` from your terminal after installation. pytest-spec automatically modifies the output."},"warnings":[{"fix":"Upgrade your Python environment to 3.10 or newer. For example: `pyenv install 3.10.12 && pyenv local 3.10.12`.","message":"Version 6.0.0 of pytest-spec drops support for Python 3.9. Users on Python 3.9 or older will experience compatibility issues.","severity":"breaking","affected_versions":"6.0.0"},{"fix":"Upgrade pytest to version 6.0.0 or newer. For example: `pip install 'pytest>=6.0.0,<10.0.0'`.","message":"Version 6.0.0 of pytest-spec drops support for pytest 4.x.x and 5.x.x. Running with these older pytest versions will lead to errors or incorrect behavior.","severity":"breaking","affected_versions":"6.0.0"},{"fix":"Add a clear, concise docstring to each test function or method explaining its purpose. Example: `def test_something(): \"\"\"It should do X when Y.\"\"\"`.","message":"For the most descriptive output, leverage docstrings in your test functions and methods. pytest-spec uses these to generate more readable specification descriptions.","severity":"gotcha","affected_versions":"all"},{"fix":"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.","message":"If you need to temporarily disable pytest-spec or are experiencing conflicts with other plugins, you can disable it directly from the command line.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"search_vec":"'6.0.0':53 'behavior':48 'cadenc':59 'clear':25 'current':50 'descript':44 'docstr':41 'execut':21 'follow':56 'format':30 'generat':43 'human':27 'human-read':26 'major':65 'mocha':35 'name':39 'output':8,22 'plugin':15,72 'pytest':2,10,14,62,68 'pytest-spec':1,9 'python':64 'readabl':28 'releas':58 'report':71 'rspec':33 'sentenc':45 'similar':31 'spec':3,11,70 'specif':5,29 'specification-styl':4 'standard':19 'style':6 'test':7,20,38,47,69 'tie':60 'transform':17 'updat':67 'use':37 'version':51,66","created_at":"2026-04-17T01:22:38.148950+00:00","updated_at":"2026-04-17T01:22:38.148950+00:00","problems":[{"fix":"Run `pip install pytest-spec` to install the plugin.","cause":"The `pytest-spec` package has not been installed in your current Python environment.","error":"ModuleNotFoundError: No module named 'pytest_spec'"},{"fix":"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`.","cause":"The `pytest-spec` plugin is either not active, has been explicitly disabled, or is being overridden by another pytest plugin.","error":"No 'spec' output, just standard pytest dots or progress."},{"fix":"Upgrade your pytest installation: `pip install 'pytest>=6.0.0,<10.0.0'`.","cause":"You are using an older version of pytest (pre-6.0.0) which is no longer supported by pytest-spec 6.0.0.","error":"You need to install pytest>=6.0.0 to use this plugin with current Python version."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/pchomik/pytest-spec","docs":"https://pchomik.ovh/docs/pytest-spec/about","changelog":"https://github.com/pchomik/pytest-spec/CHANGES.txt","pypi":"https://pypi.org/project/pytest-spec/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-04-17","next_check":"2026-07-16","install_tag":null}}