OpenNTI / sphinxcontrib-programoutput

Sphinx extension for capturing program output
BSD 3-Clause "New" or "Revised" License
37 stars 17 forks source link

Compatibility with pytest 8 #61

Open hrnciar opened 1 month ago

hrnciar commented 1 month ago

When I run the tests with pytest 8.2.0, I get the following errors:

=================================== FAILURES ===================================
_____________ TestDirective.test_shell_with_unexpected_return_code _____________

self = <programoutput.tests.test_directive.TestDirective testMethod=test_shell_with_unexpected_return_code>

    @with_content("""\
    .. program-output:: python3 -c 'import sys; sys.exit("some output")'
       :shell:""",
                  ignore_warnings=False)
    def test_shell_with_unexpected_return_code(self):
        with self.assertRaises(SphinxWarning) as excinfo:
            self.app.build()
        msg = excinfo.exception.args[0]
>       self.assertIn('Unexpected return code 1 from command',
                      msg)
E       AssertionError: 'Unexpected return code 1 from command' not found in "directive 'deprecated' is already registered, it will be overridden"

../../BUILDROOT/python-sphinxcontrib-programoutput-0.17-13.fc41.x86_64/usr/lib/python3.12/site-packages/sphinxcontrib/programoutput/tests/test_directive.py:308: AssertionError
__________________ TestDirective.test_unexpected_return_code ___________________

self = <programoutput.tests.test_directive.TestDirective testMethod=test_unexpected_return_code>

    @with_content("""\
    .. program-output:: python3 -c 'import sys; sys.exit(1)'""",
                  ignore_warnings=False)
    def test_unexpected_return_code(self):
        with self.assertRaises(SphinxWarning) as excinfo:
            self.app.build()
>       self.assertIn('Unexpected return code 1 from command',
                      excinfo.exception.args[0])
E       AssertionError: 'Unexpected return code 1 from command' not found in "directive 'deprecated' is already registered, it will be overridden"

../../BUILDROOT/python-sphinxcontrib-programoutput-0.17-13.fc41.x86_64/usr/lib/python3.12/site-packages/sphinxcontrib/programoutput/tests/test_directive.py:293: AssertionError
=========================== short test summary info ============================
FAILED ../../BUILDROOT/python-sphinxcontrib-programoutput-0.17-13.fc41.x86_64/usr/lib/python3.12/site-packages/sphinxcontrib/programoutput/tests/test_directive.py::TestDirective::test_shell_with_unexpected_return_code
FAILED ../../BUILDROOT/python-sphinxcontrib-programoutput-0.17-13.fc41.x86_64/usr/lib/python3.12/site-packages/sphinxcontrib/programoutput/tests/test_directive.py::TestDirective::test_unexpected_return_code
=========== 2 failed, 60 passed, 1 deselected, 67 warnings in 4.64s ============
kloczek commented 1 month ago

+1. I see the same fails with pytest 8.2.1.