Skip to content
This repository was archived by the owner on Jan 1, 2026. It is now read-only.

Commit 0d66a31

Browse files
committed
Unit test argument parsing.
1 parent f33984e commit 0d66a31

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

test.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
"""cppcheck-junit tests."""
44

55
import unittest
6+
import sys
67
from xml.etree import ElementTree
78

8-
from cppcheck_junit import CppcheckError, generate_test_suite, parse_cppcheck
9+
from cppcheck_junit import CppcheckError, generate_test_suite, parse_arguments, parse_cppcheck
910

1011

1112
class ParseCppcheckTestCase(unittest.TestCase):
@@ -89,5 +90,16 @@ def test_single(self):
8990
self.assertEqual(error_element.get('message'), '4: (severity) error message')
9091

9192

93+
class ParseArgumentsTestCase(unittest.TestCase):
94+
def test_no_arguments(self):
95+
with self.assertRaises(SystemExit):
96+
# Suppress argparse stderr.
97+
class NullWriter:
98+
def write(self, s):
99+
pass
100+
101+
sys.stderr = NullWriter()
102+
parse_arguments()
103+
92104
if __name__ == '__main__':
93105
unittest.main()

0 commit comments

Comments
 (0)