aboutsummaryrefslogtreecommitdiff
path: root/tests/data
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@users.noreply.github.com>2024-08-12 15:11:17 -0400
committerGitHub <noreply@github.com>2024-08-12 15:11:17 -0400
commit95672b2e7a6cc0c07306893d5bb0b80ee3570f7a (patch)
tree7167084154e521b1c82945d7e0405dbe524074ad /tests/data
parentdd2768ddcd61172cc58311fa51138281144397ae (diff)
downloadstasis-95672b2e7a6cc0c07306893d5bb0b80ee3570f7a.tar.gz
More unit tests (and fixing bugs) (#23)
* Add test_artifactory.c to suite * Add test_ini_getval_wrapper to ini.c * basic ini_getval_TYPE() conversion checks * bugfix: use strtof in INIVAL_TYPE_FLOAT case * Include stdio.h to pull in FILE structure * bugfix: free data at index during strlist_set operation * Previous behavior of setting the pointer to NULL introduced a subtle memory leak * Set strlist error when index it out of range * Import private delivery functions required for mock context creation * Remove static declaration * populate_delivery_cfg() * 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
Diffstat (limited to 'tests/data')
-rw-r--r--tests/data/result.xml10
-rw-r--r--tests/data/result_error.xml24
2 files changed, 34 insertions, 0 deletions
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 @@
+<?xml version="1.0" encoding="utf-8"?><testsuites><testsuite name="pytest" errors="0" failures="2" skipped="1" tests="4" time="0.022" timestamp="2024-08-12T13:52:02.624944-04:00" hostname="examplehost"><testcase classname="test_simple" name="test_skip" time="0.000"><skipped type="pytest.skip" message="unconditional skip">/example/test_simple.py:4: unconditional skip</skipped></testcase><testcase classname="test_simple" name="test_fail" time="0.000"><failure message="assert False">def test_fail():
+ print("oh no, this test failed.", file=sys.stderr)
+&gt; assert False
+E assert False
+
+test_simple.py:10: AssertionError</failure></testcase><testcase classname="test_simple" name="test_success" time="0.000" /><testcase classname="test_simple" name="test_error" time="0.000"><failure message="RuntimeError: uh oh, a runtime error">def test_error():
+&gt; raise RuntimeError("uh oh, a runtime error")
+E RuntimeError: uh oh, a runtime error
+
+test_simple.py:17: RuntimeError</failure></testcase></testsuite></testsuites>
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 @@
+<?xml version="1.0" encoding="utf-8"?><testsuites><testsuite name="pytest" errors="1" failures="0" skipped="0" tests="1" time="0.077" timestamp="2024-08-12T13:58:07.030762-04:00" hostname="examplehost"><testcase classname="" name="test_simple" time="0.000"><error message="collection failure">/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)
+&lt;frozen importlib._bootstrap&gt;:1204: in _gcd_import
+ ???
+&lt;frozen importlib._bootstrap&gt;:1176: in _find_and_load
+ ???
+&lt;frozen importlib._bootstrap&gt;:1147: in _find_and_load_unlocked
+ ???
+&lt;frozen importlib._bootstrap&gt;: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</error></testcase></testsuite></testsuites>