From d6205792470206b7f093f56c7d16e9b0d9d9d74d Mon Sep 17 00:00:00 2001 From: valeros Date: Fri, 25 Oct 2019 21:04:30 +0300 Subject: [PATCH] Fix tests for check command according to updated exit codes --- tests/commands/test_check.py | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/tests/commands/test_check.py b/tests/commands/test_check.py index b079aaad..c5a8a7ff 100644 --- a/tests/commands/test_check.py +++ b/tests/commands/test_check.py @@ -90,7 +90,7 @@ def test_check_cli_output(clirunner, check_dir): errors, warnings, style = count_defects(result.output) - assert result.exit_code != 0 + assert result.exit_code == 0 assert errors + warnings + style == EXPECTED_DEFECTS @@ -119,7 +119,7 @@ def test_check_severity_threshold(clirunner, check_dir): errors, warnings, style = count_defects(result.output) - assert result.exit_code != 0 + assert result.exit_code == 0 assert errors == EXPECTED_ERRORS assert warnings == 0 assert style == 0 @@ -143,7 +143,7 @@ def test_check_silent_mode(clirunner, check_dir): errors, warnings, style = count_defects(result.output) - assert result.exit_code != 0 + assert result.exit_code == 0 assert errors == EXPECTED_ERRORS assert warnings == 0 assert style == 0 @@ -158,7 +158,7 @@ def test_check_filter_sources(clirunner, check_dir): errors, warnings, style = count_defects(result.output) - assert result.exit_code != 0 + assert result.exit_code == 0 assert errors == EXPECTED_ERRORS assert warnings == EXPECTED_WARNINGS assert style == EXPECTED_STYLE @@ -277,7 +277,7 @@ R21.4 text. cmd_check, ["--project-dir", str(check_dir), "--flags=--addon=misra.json"] ) - assert result.exit_code != 0 + assert result.exit_code == 0 assert "R21.3 Found MISRA defect" in result.output assert not isfile(join(str(check_dir), "src", "main.cpp.dump")) @@ -295,14 +295,3 @@ def test_check_fails_on_defects_only_with_flag(clirunner, tmpdir): assert default_result.exit_code == 0 assert result_with_flag.exit_code != 0 - - -def test_check_bad_tool_flag_fails_check(clirunner, tmpdir): - config = DEFAULT_CONFIG + "\ncheck_tool = cppcheck, clangtidy" - config += "\ncheck_flags = --unknown-flag" - tmpdir.join("platformio.ini").write(config) - tmpdir.mkdir("src").join("main.cpp").write(TEST_CODE) - - result = clirunner.invoke(cmd_check, ["--project-dir", str(tmpdir)]) - - assert result.exit_code != 0