diff --git a/.gitignore b/.gitignore index aae5829..dc01013 100644 --- a/.gitignore +++ b/.gitignore @@ -18,5 +18,6 @@ build/ __pycache__/ data/marvinMorning_date.txt .coverage +coverage.xml dist htmlcov/ diff --git a/.scrutinizer.yml b/.scrutinizer.yml new file mode 100644 index 0000000..8a5bac2 --- /dev/null +++ b/.scrutinizer.yml @@ -0,0 +1,26 @@ +build: + environment: + python: '3.12' + + nodes: + analysis: + dependencies: + before: &dependencies + - pip install uv coverage + - uv sync + + tests: + dependencies: + before: *dependencies + tests: + override: &tests_override + - command: uv run pytest --cov=irc2phpbb + coverage: + file: .coverage + format: py-cc + + coverage: + dependencies: + before: *dependencies + tests: + override: *tests_override diff --git a/tests/test_main.py b/tests/test_main.py index 82dc62f..c94a299 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -199,12 +199,15 @@ def testUnhandledArgument(self): with self.assertRaises(SystemExit) as e: s = io.StringIO() expectedError = (f"{self.USAGE}main.py: error: argument protocol: " - "invalid choice: 'arg' (choose from 'irc', 'discord')\n") + "invalid choice: 'arg' (choose from irc, discord)\n") with contextlib.redirect_stderr(s): sys.argv = ["./main.py", "arg"] parseOptions(ConfigParseTest.SAMPLE_CONFIG) self.assertEqual(e.exception.code, 2) - self.assertEqual(s.getvalue(), expectedError) + # argparse's quoting of the choices list in this message varies between Python + # patch releases ("'irc', 'discord'" vs "irc, discord"); normalize it away. + actualError = s.getvalue().replace("'irc'", "irc").replace("'discord'", "discord") + self.assertEqual(actualError, expectedError) class TestArgumentParsing(TestCase): """Test parsing argument to determine whether to launch as irc or discord bot """