Skip to content

Commit

Permalink
fix(tests): failing tests on python3.13 about stacktrace messages #578
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
wookayin authored Oct 31, 2024
1 parent 9391eff commit 4813ce6
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions test/test_vim.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import os
import sys
import tempfile
import textwrap
from pathlib import Path

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

vim.command('python3 def raise_error(): raise RuntimeError("oops")')
with pytest.raises(NvimError) as excinfo:
vim.command_output('python3 =print("nooo", raise_error())')
assert textwrap.dedent('''\
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "<string>", line 1, in raise_error
RuntimeError: oops
''').strip() in excinfo.value.args[0]
stacktrace = excinfo.value.args[0]
assert 'File "<string>", line 1, in raise_error' in stacktrace
assert 'RuntimeError: oops' in stacktrace
assert 'nooo' not in vim.command_output(':messages')


Expand Down

0 comments on commit 4813ce6

Please sign in to comment.