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

Fix unit test for Python 3.13 #244

Merged
merged 1 commit into from
Jan 8, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 20 additions & 7 deletions tests/tool/test_ToolExecutable.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,21 +190,34 @@ def test_execute_logs_messages(self):
self.assertEqual(len(logs), 1)
with open(logs[0], "r") as f:
lines = f.readlines()
expected_lines = [
expected_stdout = [
"### Spine execution log file\n",
"### Item name: Logs stuff\n",
"### Filter id: \n",
"### Part: 1\n",
"\n",
"# Running python script.py\n",
"hello\n",
"Traceback (most recent call last):\n",
' File "<stdin>", line 3, in <module>\n',
' File "script.py", line 2, in <module>\n',
" raise ValueError('foo')\n",
"ValueError: foo\n",
]
self.assertCountEqual(lines, expected_lines)
if sys.version_info.minor < 13:
expected_stderr = [
"Traceback (most recent call last):\n",
' File "<stdin>", line 3, in <module>\n',
' File "script.py", line 2, in <module>\n',
" raise ValueError('foo')\n",
"ValueError: foo\n",
]
else:
expected_stderr = [
"Traceback (most recent call last):\n",
' File "<stdin>", line 3, in <module>\n',
" with open('script.py', 'rb') as f: exec(compile(f.read(), 'script.py', 'exec'), globals_dict, globals_dict)\n",
" ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
' File "script.py", line 2, in <module>\n',
" raise ValueError('foo')\n",
"ValueError: foo\n",
]
self.assertCountEqual(lines, expected_stdout + expected_stderr)
kill_persistent_processes()

def test_find_optional_input_files_without_wildcards(self):
Expand Down
Loading