{"id":8697,"library":"tap-py","title":"Test Anything Protocol (TAP) tools for Python","description":"tappy (installed as `tap-py`) is a set of Python tools designed for working with the Test Anything Protocol (TAP). It enables Python's unittest framework to produce TAP-formatted output, facilitating integration with other testing systems that consume TAP. The library is currently at version 3.2.1 and maintains an active, though irregular, release cadence to support new Python versions and address bug fixes.","status":"active","version":"3.2.1","language":"en","source_language":"en","source_url":"https://github.com/python-tap/tappy/","tags":["testing","TAP","unittest","test-anything-protocol"],"install":[{"cmd":"pip install tap-py","lang":"bash","label":"Core library"},{"cmd":"pip install tap-py[yaml]","lang":"bash","label":"With YAML support (for TAP version 13)"}],"dependencies":[{"reason":"Required for parsing and producing YAML blocks in TAP version 13.","package":"PyYAML","optional":true}],"imports":[{"note":"TAPTestRunner is located within the 'runner' submodule, not directly under the top-level 'tap' package.","wrong":"from tap import TAPTestRunner","symbol":"TAPTestRunner","correct":"from tap.runner import TAPTestRunner"}],"quickstart":{"code":"import unittest\nfrom tap.runner import TAPTestRunner\n\nclass MyTests(unittest.TestCase):\n    def test_example_success(self):\n        self.assertTrue(True)\n\n    def test_example_failure(self):\n        self.assertEqual(1, 2)\n\nif __name__ == '__main__':\n    # Using the TAPTestRunner to get TAP output\n    suite = unittest.TestSuite()\n    suite.addTest(unittest.makeSuite(MyTests))\n    runner = TAPTestRunner()\n    runner.run(suite)\n\n    # Alternatively, for discovery (similar to 'python -m unittest discover')\n    # and direct TAP output to console from tests in current directory:\n    # import os\n    # os.system('python -m tap')","lang":"python","description":"This quickstart demonstrates how to use `TAPTestRunner` with a standard `unittest.TestCase` to produce TAP output. The `python -m tap` command provides a convenient way to run tests and output TAP directly to the console, similar to `python -m unittest discover`."},"warnings":[{"fix":"Ensure your project is running on Python 3.9 or newer. Upgrade your code to be Python 3 compatible if necessary.","message":"Version 3.0 dropped support for Python 2. This was a significant change, requiring users to migrate to Python 3.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"If you relied on `tap-py` for `nose` or `pytest` integration, install `nose-tap` or `pytest-tap` separately (e.g., `pip install pytest-tap`).","message":"In version 2.0, the `nose` and `pytest` plugins were removed from `tap-py` and moved to separate distributions (`nose-tap` and `pytest-tap`).","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Always check the `requires_python` metadata on PyPI or the official documentation. For version 3.2.1, Python 3.9+ is required.","message":"Older Python versions are routinely dropped. As of version 3.2, Python 3.6, 3.7, and 3.8 are no longer supported.","severity":"gotcha","affected_versions":">=3.2.0"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Install `tap-py` with the `yaml` extra: `pip install tap-py[yaml]`.","cause":"Attempting to use TAP version 13 features (like YAML blocks) without installing the optional 'yaml' dependencies.","error":"ModuleNotFoundError: No module named 'tap.yaml'"},{"fix":"Change your import statement from `from tap import TAPTestRunner` to `from tap.runner import TAPTestRunner`.","cause":"Incorrect import path for `TAPTestRunner`. It resides in the `tap.runner` submodule.","error":"AttributeError: module 'tap' has no attribute 'TAPTestRunner'"},{"fix":"To get TAP output, either use `from tap.runner import TAPTestRunner` in your test runner setup, or simply execute your tests using `python -m tap` in the directory containing your tests.","cause":"The default `unittest.TextTestRunner` is being used, or the `python -m tap` command-line entry point was not utilized. `tap-py` provides specific runners to generate TAP output.","error":"My tests run, but I don't see any TAP output."}]}