Skip to content

Commit fd438d9

Browse files
committed
fix(tests): failing tests on python3.13 about stacktrace messages
Fixes #571. Problem: The `test_python3_ex_eval` test fails on python3.13 because the format of stacktrace message has changed. Solution: Check for important lines only.
1 parent 9391eff commit fd438d9

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

test/test_vim.py

+8-12
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import os
44
import sys
55
import tempfile
6-
import textwrap
76
from pathlib import Path
87

98
import pytest
@@ -232,21 +231,18 @@ def test_python3_ex_eval(vim: Nvim) -> None:
232231
# because the Ex command :python will throw (wrapped with provider#python3#Call)
233232
with pytest.raises(NvimError) as excinfo:
234233
vim.command('py3= 1/0')
235-
assert textwrap.dedent('''\
236-
Traceback (most recent call last):
237-
File "<string>", line 1, in <module>
238-
ZeroDivisionError: division by zero
239-
''').strip() in excinfo.value.args[0]
234+
stacktrace = excinfo.value.args[0]
235+
assert 'Traceback (most recent call last):' in stacktrace
236+
assert 'File "<string>", line 1, in <module>' in stacktrace
237+
assert 'ZeroDivisionError: division by zero' in stacktrace
240238

241239
vim.command('python3 def raise_error(): raise RuntimeError("oops")')
242240
with pytest.raises(NvimError) as excinfo:
243241
vim.command_output('python3 =print("nooo", raise_error())')
244-
assert textwrap.dedent('''\
245-
Traceback (most recent call last):
246-
File "<string>", line 1, in <module>
247-
File "<string>", line 1, in raise_error
248-
RuntimeError: oops
249-
''').strip() in excinfo.value.args[0]
242+
stacktrace = excinfo.value.args[0]
243+
assert 'Traceback (most recent call last):' in stacktrace
244+
assert 'File "<string>", line 1, in raise_error' in stacktrace
245+
assert 'RuntimeError: oops' in stacktrace
250246
assert 'nooo' not in vim.command_output(':messages')
251247

252248

0 commit comments

Comments
 (0)