tappy icon indicating copy to clipboard operation
tappy copied to clipboard

Explicitly log a TAP v13+ version number as the first line of output

Open smcv opened this issue 2 years ago • 4 comments

In TAP v13 and higher, the specification says the first line must be:

TAP version 13

or similar. Some TAP consumers (notably Meson) emit warnings if this line is not emitted.

I personally think Meson is wrong to warn on this, because a TAP stream without this first line is not valid TAP v13, but is perfectly valid TAP v12 - but the warnings are quite visible and could mislead bug reporters into thinking tests that use TAPTestRunner are broken.

smcv avatar Jan 28 '23 11:01 smcv

I personally think Meson is wrong to warn on this

It looks as though Meson will stop making noise about this when https://github.com/mesonbuild/meson/commit/8d39c9273b58a7a9ba3c4c34125d5f37e5684a99 gets into a release, making it less necessary to change tappy.

smcv avatar Jan 28 '23 11:01 smcv

Hi @smcv! Thanks for the issue. I'm not sure I understand this issue. tappy does write the version line (see: https://github.com/python-tap/tappy/blob/e60d0a3d3ac5737e5a31a8494500ffbd6de4b8b0/tap/tracker.py#L184). Did you find a scenario where it is erroneously not including the version line?

mblayman avatar Jan 28 '23 15:01 mblayman

Sorry, I should have been clearer about what parts of tappy I'm using. This is an issue with TAPTestRunner, and here's a reproducer simplified from one of the projects I use it in:

#!/usr/bin/python3

import unittest

from tap.runner import TAPTestRunner

class MyTestCase(unittest.TestCase):
    def test_a_thing(self):
        pass

if __name__ == '__main__':
    runner = TAPTestRunner()
    runner.set_stream(True)
    unittest.main(testRunner=runner)

smcv avatar Jan 28 '23 18:01 smcv

Ah, the problem might be that a Tracker in streaming mode writes out the version in __init__, but the way I'm using it, streaming mode isn't set up until after that point.

smcv avatar Jan 28 '23 18:01 smcv