Test Anything Protocol (TAP) tools for Python

3.2.1 · active · verified Thu Apr 16

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.

Common errors

Warnings

Install

Imports

Quickstart

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`.

import unittest
from tap.runner import TAPTestRunner

class MyTests(unittest.TestCase):
    def test_example_success(self):
        self.assertTrue(True)

    def test_example_failure(self):
        self.assertEqual(1, 2)

if __name__ == '__main__':
    # Using the TAPTestRunner to get TAP output
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(MyTests))
    runner = TAPTestRunner()
    runner.run(suite)

    # Alternatively, for discovery (similar to 'python -m unittest discover')
    # and direct TAP output to console from tests in current directory:
    # import os
    # os.system('python -m tap')

view raw JSON →