From 7939dbc4ae45aec2f5948cfb7feed0c4cebf9fa2 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Mon, 12 Aug 2024 14:36:21 -0400 Subject: Add test_junitxml.c * Fix duplicate define value for JUNIT_RESULT_STATE_ERROR * Add static junit test data * Copy test data to current test directory --- tests/data/result.xml | 10 ++++++++++ tests/data/result_error.xml | 24 ++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 tests/data/result.xml create mode 100644 tests/data/result_error.xml (limited to 'tests/data') diff --git a/tests/data/result.xml b/tests/data/result.xml new file mode 100644 index 0000000..81df70f --- /dev/null +++ b/tests/data/result.xml @@ -0,0 +1,10 @@ +/example/test_simple.py:4: unconditional skipdef test_fail(): + print("oh no, this test failed.", file=sys.stderr) +> assert False +E assert False + +test_simple.py:10: AssertionErrordef test_error(): +> raise RuntimeError("uh oh, a runtime error") +E RuntimeError: uh oh, a runtime error + +test_simple.py:17: RuntimeError diff --git a/tests/data/result_error.xml b/tests/data/result_error.xml new file mode 100644 index 0000000..cbb7a86 --- /dev/null +++ b/tests/data/result_error.xml @@ -0,0 +1,24 @@ +/example/miniforge3/envs/test/lib/python3.11/site-packages/_pytest/python.py:493: in importtestmodule + mod = import_path( +/example/miniforge3/envs/test/lib/python3.11/site-packages/_pytest/pathlib.py:582: in import_path + importlib.import_module(module_name) +/example/miniforge3/envs/test/lib/python3.11/importlib/__init__.py:126: in import_module + return _bootstrap._gcd_import(name[level:], package, level) +<frozen importlib._bootstrap>:1204: in _gcd_import + ??? +<frozen importlib._bootstrap>:1176: in _find_and_load + ??? +<frozen importlib._bootstrap>:1147: in _find_and_load_unlocked + ??? +<frozen importlib._bootstrap>:690: in _load_unlocked + ??? +/example/miniforge3/envs/test/lib/python3.11/site-packages/_pytest/assertion/rewrite.py:165: in exec_module + source_stat, co = _rewrite_test(fn, self.config) +/example/miniforge3/envs/test/lib/python3.11/site-packages/_pytest/assertion/rewrite.py:345: in _rewrite_test + tree = ast.parse(source, filename=strfn) +/example/miniforge3/envs/test/lib/python3.11/ast.py:50: in parse + return compile(source, filename, mode, flags, +E File "/tmp/bleh/test_simple.py", line 17 +E syntax error here +E ^^^^^ +E SyntaxError: invalid syntax -- cgit