Package: taptaptap3
name:taptaptapAuthor:Lukas ProkopDate:Feb-Apr 2014, Jul 2018license:BSD 3-clauseVersion:3.0.0issues:http://github.com/meisterluk/taptaptap3/issuesTest Anything Protocol handling for cat lovers *rawwr*Table of contentsCompatibilityThe File FormatTestsuite & ExamplesCommand line toolsPicklingWhen to usetaptaptap3taptaptap3provides parsers, writers and APIs to handle the Test Anything Protocol (TAP). The implementation focuses on the most-current TAP version 13. TAP originates from the Perl community, but is a general format to document runs of testsuites. The reference to cats is just a pun for the noise of cats sneaking on floors and “3” is part of “<3”, thus “lovers”.Compatibilitytaptaptap3is only supposed to be working with python 3.5 upwards.
It was written for python 2.7 as packagetaptaptapand this implementation is a port to python3.
It has been tested with Python 3.6.5 on xubuntu 18.04 (Linux 4.15 x86_64)The File FormatA basic introduction is given by Wikipedia. The format was specified by the Perl community.The Wikipedia articleOriginal specificationTest::HarnessTestsuite & Examplestaptaptap3comes with a testsuite, which covers many special cases of the TAP format and tests the provided APIs. Please don’t hesitate to report anyissues.You can run thetaptaptap3testcases yourself using:./run.shin the tests directory. The testsuite also shows some API usage examples, but I want to provide some here. The procedural API is well-suited if you are in the python REPL:from taptaptap3.proc import plan, ok, not_ok, out
plan(tests=10)
ok('Starting the robot')
not_ok('Starting the engine')
not_ok('Find the object', skip='Setup required')
not_ok('Terminate', skip='Setup required')

out()The output looks like this:1..10
ok - Starting the robot
not ok - Starting the engine
not ok - Find the object  # SKIP Setup required
not ok - Terminate  # SKIP Setup requiredBe aware that the state is stored within the module. This is not what you want if you are outside the REPL. TheTapWriterclass is more convenient in this case:import taptaptap3

writer = taptaptap3.TapWriter()
writer.plan(1, 3)
writer.ok('This testcase went fine')
writer.ok('And another one')
writer.ok('And also the last one')If you like python’s generators, you want to useSimpleTapCreator:@taptaptap3.SimpleTapCreator
def runTests():
    yield True
    yield True
    yield False

print runTests()Giving us:1..3
ok
ok
not okOr take a look at the more sophisticatedTapCreator. If you are a real expert, you can useTapDocumentdirectly, which covers all possibilities of TAP.Command line toolsYou can also invoketaptaptap3directly from the command line:python -m taptaptap3.__main__ some_tap_file_to_validate.tapThis command will parse the file and write the file in a way how it was understood by the module. The exit code indicates its validity:0Everything fine.1The TAP file is missing some testcases or contains failed testcases.2A bailout was raised. So the testing environment crashed during the run.PicklingAll objects are pickable.When to usetaptaptap3Doestaptaptap3suite your needs?
It does, if you are looking for a parser and validator for your TAP documents and you don’t want to care about details and just need a gentle API.best regards,
meisterluk