Skip to content

Commit 4813ce6

Browse files
authored
fix(tests): failing tests on python3.13 about stacktrace messages #578
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 4813ce6

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

test/test_vim.py

+6-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,16 @@ 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 'File "<string>", line 1, in <module>' in stacktrace
236+
assert 'ZeroDivisionError: division by zero' in stacktrace
240237

241238
vim.command('python3 def raise_error(): raise RuntimeError("oops")')
242239
with pytest.raises(NvimError) as excinfo:
243240
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]
241+
stacktrace = excinfo.value.args[0]
242+
assert 'File "<string>", line 1, in raise_error' in stacktrace
243+
assert 'RuntimeError: oops' in stacktrace
250244
assert 'nooo' not in vim.command_output(':messages')
251245

252246

0 commit comments

Comments
 (0)