Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test failures with Pygments 2.14 #345

Open
davide125 opened this issue Feb 3, 2023 · 0 comments
Open

Test failures with Pygments 2.14 #345

davide125 opened this issue Feb 3, 2023 · 0 comments

Comments

@davide125
Copy link
Member

TestSlide has some test failures with Pygments 2.14. This was reported downstream in https://bugzilla.redhat.com/show_bug.cgi?id=2166612 and is blocking a Fedora update.

============================= test session starts ==============================
platform linux -- Python 3.11.1, pytest-7.2.1, pluggy-1.0.0
rootdir: /builddir/build/BUILD/TestSlide-2.7.0
plugins: typeguard-2.13.3
collected 162 items

tests/cli_unittest.py ...............F..........F........F               [ 22%]
tests/dsl_unittest.py .................................................. [ 53%]
..................................                                       [ 74%]
tests/matchers_unittest.py .....................................         [ 96%]
tests/testcase_unittest.py .....                                         [100%]

=================================== FAILURES ===================================
__________ TestCliDocumentFormatter.test_prints_exceptions_with_cause __________

self = <tests.cli_unittest.TestCliDocumentFormatter testMethod=test_prints_exceptions_with_cause>

    def test_prints_exceptions_with_cause(self):
>       self.run_testslide(
            tty_stdout=True,
            expected_return_code=1,
            expected_in_stdout=(
                '      File \033[36m"tests/sample_tests.py"\033[39;49;00m, line \033[34m76\033[39;49;00m, in test_failing\r\n'
                '        \033[34mraise\033[39;49;00m \033[36mAssertionError\033[39;49;00m(\033[33m"\033[39;49;00m\033[33mThird\033[39;49;00m\033[33m"\033[39;49;00m) \033[34mfrom\033[39;49;00m \033[04m\033[36mcause\033[39;49;00m\r\n'
                "\033[0m\033[31m      Caused by \033[0m\033[0m\033[31mAssertionError: Second\033[0m\r\n"
                '        File \033[36m"tests/sample_tests.py"\033[39;49;00m, line \033[34m74\033[39;49;00m, in test_failing\r\n'
                '          \033[34mraise\033[39;49;00m \033[36mAssertionError\033[39;49;00m(\033[33m"\033[39;49;00m\033[33mSecond\033[39;49;00m\033[33m"\033[39;49;00m) \033[34mfrom\033[39;49;00m \033[04m\033[36mcause\033[39;49;00m\r\n'
                "\033[0m\033[31m        Caused by \033[0m\033[0m\033[31mAssertionError: First\033[0m\r\n"
                '          File \033[36m"tests/sample_tests.py"\033[39;49;00m, line \033[34m72\033[39;49;00m, in test_failing\r\n'
                '            \033[34mraise\033[39;49;00m \033[36mAssertionError\033[39;49;00m(\033[33m"\033[39;49;00m\033[33mFirst\033[39;49;00m\033[33m"\033[39;49;00m)\r\n'
            ),
        )

tests/cli_unittest.py:284: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/cli_unittest.py:137: in run_testslide
    self.assertTrue(
E   AssertionError: False is not true : Command ['/usr/bin/python3', '-m', 'testslide.cli', '--show-testslide-stack-trace', '--format', 'documentation', '/builddir/build/BUILD/TestSlide-2.7.0/tests/sample_tests.py'] expected to have have in its stdout:
E   
E         File "tests/sample_tests.py", line 76, in test_failing
E           raise AssertionError("Third") from cause
E         Caused by AssertionError: Second
E           File "tests/sample_tests.py", line 74, in test_failing
E             raise AssertionError("Second") from cause
E           Caused by AssertionError: First
E             File "tests/sample_tests.py", line 72, in test_failing
E               raise AssertionError("First")
E   
E   
E   But output was different:
E   top context
E     passing example
E     failing example: SimulatedFailure: test failure (extra)
E     *focused example
E     skipped example
E     unittest SkipTest
E     nested context
E       passing nested example
E   tests.sample_tests.SampleTestCase
E     test_failing: AssertionError: Third
E     test_passing
E     test_skipped
E   
E   Failures:
E   
E     1) top context: failing example
E       1) SimulatedFailure: test failure (extra)
E         File "testslide/runner.py", line 789, in run
E           self._run_example(example)
E         File "testslide/runner.py", line 773, in _run_example
E           _ExampleRunner(example, self.formatter).run()
E         File "testslide/__init__.py", line 540, in run
E           self._sync_run_all_hooks_and_example(context_data)
E         File "testslide/__init__.py", line 512, in _sync_run_all_hooks_and_example
E           aggregated_exceptions.raise_correct_exception()
E         File "testslide/__init__.py", line 289, in raise_correct_exception
E           raise self.exceptions[0]
E         File "testslide/__init__.py", line 273, in catch
E           yield
E         File "testslide/__init__.py", line 503, in _sync_run_all_hooks_and_example
E           self._fail_if_coroutine_function(self.example.code, context_data)
E         File "testslide/__init__.py", line 471, in _fail_if_coroutine_function
E           return func(*args, **kwargs)
E         File "tests/sample_tests.py", line 42, in failing_example
E           raise SimulatedFailure("test failure", "(extra)")
E   
E     2) tests.sample_tests.SampleTestCase: test_failing
E       1) AssertionError: Third
E         File "testslide/runner.py", line 789, in run
E           self._run_example(example)
E         File "testslide/runner.py", line 773, in _run_example
E           _ExampleRunner(example, self.formatter).run()
E         File "testslide/__init__.py", line 540, in run
E           self._sync_run_all_hooks_and_example(context_data)
E         File "testslide/__init__.py", line 512, in _sync_run_all_hooks_and_example
E           aggregated_exceptions.raise_correct_exception()
E         File "testslide/__init__.py", line 289, in raise_correct_exception
E           raise self.exceptions[0]
E         File "testslide/__init__.py", line 273, in catch
E           yield
E         File "testslide/__init__.py", line 503, in _sync_run_all_hooks_and_example
E           self._fail_if_coroutine_function(self.example.code, context_data)
E         File "testslide/__init__.py", line 471, in _fail_if_coroutine_function
E           return func(*args, **kwargs)
E         File "testslide/cli.py", line 121, in example_code
E           with test_result() as result:
E         File "/usr/lib64/python3.11/contextlib.py", line 144, in __exit__
E           next(self.gen)
E         File "testslide/cli.py", line 110, in test_result
E           result.aggregated_exceptions.raise_correct_exception()
E         File "testslide/__init__.py", line 289, in raise_correct_exception
E           raise self.exceptions[0]
E         File "/usr/lib64/python3.11/unittest/case.py", line 57, in testPartExecutor
E           yield
E         File "/usr/lib64/python3.11/unittest/case.py", line 623, in run
E           self._callTestMethod(testMethod)
E         File "/usr/lib64/python3.11/unittest/case.py", line 579, in _callTestMethod
E           if method() is not None:
E         File "tests/sample_tests.py", line 76, in test_failing
E           raise AssertionError("Third") from cause
E         Caused by AssertionError: Second
E           File "tests/sample_tests.py", line 74, in test_failing
E             raise AssertionError("Second") from cause
E           Caused by AssertionError: First
E             File "tests/sample_tests.py", line 72, in test_failing
E               raise AssertionError("First")
E   
E   Executed 9 examples in 0.8s:
E     Successful: 4
E     Failed: 2
E     Skipped: 3
E     Not executed: 0
E   https://testslide.readthedocs.io/
__________ TestCliProgressFormatter.test_prints_exceptions_with_cause __________

self = <tests.cli_unittest.TestCliProgressFormatter testMethod=test_prints_exceptions_with_cause>

    def test_prints_exceptions_with_cause(self):
>       self.run_testslide(
            tty_stdout=True,
            expected_return_code=1,
            expected_in_stdout=(
                '      File \033[36m"tests/sample_tests.py"\033[39;49;00m, line \033[34m76\033[39;49;00m, in test_failing\r\n'
                '        \033[34mraise\033[39;49;00m \033[36mAssertionError\033[39;49;00m(\033[33m"\033[39;49;00m\033[33mThird\033[39;49;00m\033[33m"\033[39;49;00m) \033[34mfrom\033[39;49;00m \033[04m\033[36mcause\033[39;49;00m\r\n'
                "\033[0m\033[31m      Caused by \033[0m\033[0m\033[31mAssertionError: Second\033[0m\r\n"
                '        File \033[36m"tests/sample_tests.py"\033[39;49;00m, line \033[34m74\033[39;49;00m, in test_failing\r\n'
                '          \033[34mraise\033[39;49;00m \033[36mAssertionError\033[39;49;00m(\033[33m"\033[39;49;00m\033[33mSecond\033[39;49;00m\033[33m"\033[39;49;00m) \033[34mfrom\033[39;49;00m \033[04m\033[36mcause\033[39;49;00m\r\n'
                "\033[0m\033[31m        Caused by \033[0m\033[0m\033[31mAssertionError: First\033[0m\r\n"
                '          File \033[36m"tests/sample_tests.py"\033[39;49;00m, line \033[34m72\033[39;49;00m, in test_failing\r\n'
                '            \033[34mraise\033[39;49;00m \033[36mAssertionError\033[39;49;00m(\033[33m"\033[39;49;00m\033[33mFirst\033[39;49;00m\033[33m"\033[39;49;00m)\r\n'
            ),
        )

tests/cli_unittest.py:284: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/cli_unittest.py:137: in run_testslide
    self.assertTrue(
E   AssertionError: False is not true : Command ['/usr/bin/python3', '-m', 'testslide.cli', '--show-testslide-stack-trace', '/builddir/build/BUILD/TestSlide-2.7.0/tests/sample_tests.py', '--format', 'progress'] expected to have have in its stdout:
E   
E         File "tests/sample_tests.py", line 76, in test_failing
E           raise AssertionError("Third") from cause
E         Caused by AssertionError: Second
E           File "tests/sample_tests.py", line 74, in test_failing
E             raise AssertionError("Second") from cause
E           Caused by AssertionError: First
E             File "tests/sample_tests.py", line 72, in test_failing
E               raise AssertionError("First")
E   
E   
E   But output was different:
E   .F.SS.F.S
E   Failures:
E   
E     1) top context: failing example
E       1) SimulatedFailure: test failure (extra)
E         File "testslide/runner.py", line 789, in run
E           self._run_example(example)
E         File "testslide/runner.py", line 773, in _run_example
E           _ExampleRunner(example, self.formatter).run()
E         File "testslide/__init__.py", line 540, in run
E           self._sync_run_all_hooks_and_example(context_data)
E         File "testslide/__init__.py", line 512, in _sync_run_all_hooks_and_example
E           aggregated_exceptions.raise_correct_exception()
E         File "testslide/__init__.py", line 289, in raise_correct_exception
E           raise self.exceptions[0]
E         File "testslide/__init__.py", line 273, in catch
E           yield
E         File "testslide/__init__.py", line 503, in _sync_run_all_hooks_and_example
E           self._fail_if_coroutine_function(self.example.code, context_data)
E         File "testslide/__init__.py", line 471, in _fail_if_coroutine_function
E           return func(*args, **kwargs)
E         File "tests/sample_tests.py", line 42, in failing_example
E           raise SimulatedFailure("test failure", "(extra)")
E   
E     2) tests.sample_tests.SampleTestCase: test_failing
E       1) AssertionError: Third
E         File "testslide/runner.py", line 789, in run
E           self._run_example(example)
E         File "testslide/runner.py", line 773, in _run_example
E           _ExampleRunner(example, self.formatter).run()
E         File "testslide/__init__.py", line 540, in run
E           self._sync_run_all_hooks_and_example(context_data)
E         File "testslide/__init__.py", line 512, in _sync_run_all_hooks_and_example
E           aggregated_exceptions.raise_correct_exception()
E         File "testslide/__init__.py", line 289, in raise_correct_exception
E           raise self.exceptions[0]
E         File "testslide/__init__.py", line 273, in catch
E           yield
E         File "testslide/__init__.py", line 503, in _sync_run_all_hooks_and_example
E           self._fail_if_coroutine_function(self.example.code, context_data)
E         File "testslide/__init__.py", line 471, in _fail_if_coroutine_function
E           return func(*args, **kwargs)
E         File "testslide/cli.py", line 121, in example_code
E           with test_result() as result:
E         File "/usr/lib64/python3.11/contextlib.py", line 144, in __exit__
E           next(self.gen)
E         File "testslide/cli.py", line 110, in test_result
E           result.aggregated_exceptions.raise_correct_exception()
E         File "testslide/__init__.py", line 289, in raise_correct_exception
E           raise self.exceptions[0]
E         File "/usr/lib64/python3.11/unittest/case.py", line 57, in testPartExecutor
E           yield
E         File "/usr/lib64/python3.11/unittest/case.py", line 623, in run
E           self._callTestMethod(testMethod)
E         File "/usr/lib64/python3.11/unittest/case.py", line 579, in _callTestMethod
E           if method() is not None:
E         File "tests/sample_tests.py", line 76, in test_failing
E           raise AssertionError("Third") from cause
E         Caused by AssertionError: Second
E           File "tests/sample_tests.py", line 74, in test_failing
E             raise AssertionError("Second") from cause
E           Caused by AssertionError: First
E             File "tests/sample_tests.py", line 72, in test_failing
E               raise AssertionError("First")
____________ TestCliLongFormatter.test_prints_exceptions_with_cause ____________

self = <tests.cli_unittest.TestCliLongFormatter testMethod=test_prints_exceptions_with_cause>

    def test_prints_exceptions_with_cause(self):
>       self.run_testslide(
            tty_stdout=True,
            expected_return_code=1,
            expected_in_stdout=(
                '      File \033[36m"tests/sample_tests.py"\033[39;49;00m, line \033[34m76\033[39;49;00m, in test_failing\r\n'
                '        \033[34mraise\033[39;49;00m \033[36mAssertionError\033[39;49;00m(\033[33m"\033[39;49;00m\033[33mThird\033[39;49;00m\033[33m"\033[39;49;00m) \033[34mfrom\033[39;49;00m \033[04m\033[36mcause\033[39;49;00m\r\n'
                "\033[0m\033[31m      Caused by \033[0m\033[0m\033[31mAssertionError: Second\033[0m\r\n"
                '        File \033[36m"tests/sample_tests.py"\033[39;49;00m, line \033[34m74\033[39;49;00m, in test_failing\r\n'
                '          \033[34mraise\033[39;49;00m \033[36mAssertionError\033[39;49;00m(\033[33m"\033[39;49;00m\033[33mSecond\033[39;49;00m\033[33m"\033[39;49;00m) \033[34mfrom\033[39;49;00m \033[04m\033[36mcause\033[39;49;00m\r\n'
                "\033[0m\033[31m        Caused by \033[0m\033[0m\033[31mAssertionError: First\033[0m\r\n"
                '          File \033[36m"tests/sample_tests.py"\033[39;49;00m, line \033[34m72\033[39;49;00m, in test_failing\r\n'
                '            \033[34mraise\033[39;49;00m \033[36mAssertionError\033[39;49;00m(\033[33m"\033[39;49;00m\033[33mFirst\033[39;49;00m\033[33m"\033[39;49;00m)\r\n'
            ),
        )

tests/cli_unittest.py:284: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/cli_unittest.py:137: in run_testslide
    self.assertTrue(
E   AssertionError: False is not true : Command ['/usr/bin/python3', '-m', 'testslide.cli', '--show-testslide-stack-trace', '--format', 'long', '/builddir/build/BUILD/TestSlide-2.7.0/tests/sample_tests.py'] expected to have have in its stdout:
E   
E         File "tests/sample_tests.py", line 76, in test_failing
E           raise AssertionError("Third") from cause
E         Caused by AssertionError: Second
E           File "tests/sample_tests.py", line 74, in test_failing
E             raise AssertionError("Second") from cause
E           Caused by AssertionError: First
E             File "tests/sample_tests.py", line 72, in test_failing
E               raise AssertionError("First")
E   
E   
E   But output was different:
E   top context: passing example
E   top context: failing example: SimulatedFailure: test failure (extra)
E   top context: *focused example
E   top context: skipped example
E   top context: unittest SkipTest
E   top context, nested context: passing nested example
E   tests.sample_tests.SampleTestCase: test_failing: AssertionError: Third
E   tests.sample_tests.SampleTestCase: test_passing
E   tests.sample_tests.SampleTestCase: test_skipped
E   
E   Failures:
E   
E     1) top context: failing example
E       1) SimulatedFailure: test failure (extra)
E         File "testslide/runner.py", line 789, in run
E           self._run_example(example)
E         File "testslide/runner.py", line 773, in _run_example
E           _ExampleRunner(example, self.formatter).run()
E         File "testslide/__init__.py", line 540, in run
E           self._sync_run_all_hooks_and_example(context_data)
E         File "testslide/__init__.py", line 512, in _sync_run_all_hooks_and_example
E           aggregated_exceptions.raise_correct_exception()
E         File "testslide/__init__.py", line 289, in raise_correct_exception
E           raise self.exceptions[0]
E         File "testslide/__init__.py", line 273, in catch
E           yield
E         File "testslide/__init__.py", line 503, in _sync_run_all_hooks_and_example
E           self._fail_if_coroutine_function(self.example.code, context_data)
E         File "testslide/__init__.py", line 471, in _fail_if_coroutine_function
E           return func(*args, **kwargs)
E         File "tests/sample_tests.py", line 42, in failing_example
E           raise SimulatedFailure("test failure", "(extra)")
E   
E     2) tests.sample_tests.SampleTestCase: test_failing
E       1) AssertionError: Third
E         File "testslide/runner.py", line 789, in run
E           self._run_example(example)
E         File "testslide/runner.py", line 773, in _run_example
E           _ExampleRunner(example, self.formatter).run()
E         File "testslide/__init__.py", line 540, in run
E           self._sync_run_all_hooks_and_example(context_data)
E         File "testslide/__init__.py", line 512, in _sync_run_all_hooks_and_example
E           aggregated_exceptions.raise_correct_exception()
E         File "testslide/__init__.py", line 289, in raise_correct_exception
E           raise self.exceptions[0]
E         File "testslide/__init__.py", line 273, in catch
E           yield
E         File "testslide/__init__.py", line 503, in _sync_run_all_hooks_and_example
E           self._fail_if_coroutine_function(self.example.code, context_data)
E         File "testslide/__init__.py", line 471, in _fail_if_coroutine_function
E           return func(*args, **kwargs)
E         File "testslide/cli.py", line 121, in example_code
E           with test_result() as result:
E         File "/usr/lib64/python3.11/contextlib.py", line 144, in __exit__
E           next(self.gen)
E         File "testslide/cli.py", line 110, in test_result
E           result.aggregated_exceptions.raise_correct_exception()
E         File "testslide/__init__.py", line 289, in raise_correct_exception
E           raise self.exceptions[0]
E         File "/usr/lib64/python3.11/unittest/case.py", line 57, in testPartExecutor
E           yield
E         File "/usr/lib64/python3.11/unittest/case.py", line 623, in run
E           self._callTestMethod(testMethod)
E         File "/usr/lib64/python3.11/unittest/case.py", line 579, in _callTestMethod
E           if method() is not None:
E         File "tests/sample_tests.py", line 76, in test_failing
E           raise AssertionError("Third") from cause
E         Caused by AssertionError: Second
E           File "tests/sample_tests.py", line 74, in test_failing
E             raise AssertionError("Second") from cause
E           Caused by AssertionError: First
E             File "tests/sample_tests.py", line 72, in test_failing
E               raise AssertionError("First")
E   
E   Executed 9 examples in 0.8s:
E     Successful: 4
E     Failed: 2
E     Skipped: 3
E     Not executed: 0
E   https://testslide.readthedocs.io/
=========================== short test summary info ============================
FAILED tests/cli_unittest.py::TestCliDocumentFormatter::test_prints_exceptions_with_cause
FAILED tests/cli_unittest.py::TestCliProgressFormatter::test_prints_exceptions_with_cause
FAILED tests/cli_unittest.py::TestCliLongFormatter::test_prints_exceptions_with_cause
======================== 3 failed, 159 passed in 5.95s =========================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant