mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Tests: Adjust traceback regexes to allow Python 3.11+ ^^^^^^^
Fixes https://github.com/pre-commit/pre-commit/issues/2451
This commit is contained in:
parent
98bb7e6630
commit
901e831313
1 changed files with 6 additions and 0 deletions
|
|
@ -45,9 +45,11 @@ def test_error_handler_fatal_error(mocked_log_and_exit):
|
||||||
r'Traceback \(most recent call last\):\n'
|
r'Traceback \(most recent call last\):\n'
|
||||||
r' File ".+pre_commit.error_handler.py", line \d+, in error_handler\n'
|
r' File ".+pre_commit.error_handler.py", line \d+, in error_handler\n'
|
||||||
r' yield\n'
|
r' yield\n'
|
||||||
|
r'( \^\^\^\^\^\n)?'
|
||||||
r' File ".+tests.error_handler_test.py", line \d+, '
|
r' File ".+tests.error_handler_test.py", line \d+, '
|
||||||
r'in test_error_handler_fatal_error\n'
|
r'in test_error_handler_fatal_error\n'
|
||||||
r' raise exc\n'
|
r' raise exc\n'
|
||||||
|
r'( \^\^\^\^\^\^\^\^\^\n)?'
|
||||||
r'(pre_commit\.errors\.)?FatalError: just a test\n',
|
r'(pre_commit\.errors\.)?FatalError: just a test\n',
|
||||||
)
|
)
|
||||||
pattern.assert_matches(mocked_log_and_exit.call_args[0][3])
|
pattern.assert_matches(mocked_log_and_exit.call_args[0][3])
|
||||||
|
|
@ -69,9 +71,11 @@ def test_error_handler_uncaught_error(mocked_log_and_exit):
|
||||||
r'Traceback \(most recent call last\):\n'
|
r'Traceback \(most recent call last\):\n'
|
||||||
r' File ".+pre_commit.error_handler.py", line \d+, in error_handler\n'
|
r' File ".+pre_commit.error_handler.py", line \d+, in error_handler\n'
|
||||||
r' yield\n'
|
r' yield\n'
|
||||||
|
r'( \^\^\^\^\^\n)?'
|
||||||
r' File ".+tests.error_handler_test.py", line \d+, '
|
r' File ".+tests.error_handler_test.py", line \d+, '
|
||||||
r'in test_error_handler_uncaught_error\n'
|
r'in test_error_handler_uncaught_error\n'
|
||||||
r' raise exc\n'
|
r' raise exc\n'
|
||||||
|
r'( \^\^\^\^\^\^\^\^\^\n)?'
|
||||||
r'ValueError: another test\n',
|
r'ValueError: another test\n',
|
||||||
)
|
)
|
||||||
pattern.assert_matches(mocked_log_and_exit.call_args[0][3])
|
pattern.assert_matches(mocked_log_and_exit.call_args[0][3])
|
||||||
|
|
@ -93,9 +97,11 @@ def test_error_handler_keyboardinterrupt(mocked_log_and_exit):
|
||||||
r'Traceback \(most recent call last\):\n'
|
r'Traceback \(most recent call last\):\n'
|
||||||
r' File ".+pre_commit.error_handler.py", line \d+, in error_handler\n'
|
r' File ".+pre_commit.error_handler.py", line \d+, in error_handler\n'
|
||||||
r' yield\n'
|
r' yield\n'
|
||||||
|
r'( \^\^\^\^\^\n)?'
|
||||||
r' File ".+tests.error_handler_test.py", line \d+, '
|
r' File ".+tests.error_handler_test.py", line \d+, '
|
||||||
r'in test_error_handler_keyboardinterrupt\n'
|
r'in test_error_handler_keyboardinterrupt\n'
|
||||||
r' raise exc\n'
|
r' raise exc\n'
|
||||||
|
r'( \^\^\^\^\^\^\^\^\^\n)?'
|
||||||
r'KeyboardInterrupt\n',
|
r'KeyboardInterrupt\n',
|
||||||
)
|
)
|
||||||
pattern.assert_matches(mocked_log_and_exit.call_args[0][3])
|
pattern.assert_matches(mocked_log_and_exit.call_args[0][3])
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue