Fix test_version on Python 3.14

Python 3.14's argparse changed how it reports the program name such that this test failed if it was run under python3.14 -m pytest (as opposed to simply pytest):

_________________________________ test_version _________________________________

capsys = <_pytest.capture.CaptureFixture object at 0x7f07b3968f50>

    def test_version(capsys):
        with pytest.raises(SystemExit) as excinfo:
            cmd.run(['foobar', '--version'])
        assert excinfo.value.code == 0
        out, err = capsys.readouterr()
        if sys.version_info < (3,0):
            # for Python 2.7 message are written to stderr
            out = err
        assert len(out.splitlines()) == 1
        progname = os.path.basename(sys.argv[0])
>       assert out.strip() == ('%s %s' % (progname, __version__))
E       AssertionError: assert 'python3.14 -m pytest 0.9.1' == '__main__.py 0.9.1'
E
E         - __main__.py 0.9.1
E         + python3.14 -m pytest 0.9.1

test/functional/test_cmd.py:59: AssertionError

Apply a monkey-patch to avoid this.

Merge request reports

Loading