Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: improved logging #14

Merged
merged 16 commits into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,6 @@ def read_yaml_as_dict(filename_path: Path) -> Dict[str, str]:

def compare_failures(failures: List[str], expected: List[str]):
if sorted(failures) != sorted(expected):
logging.error(
"Appinspect failures doesn't match appinspect.expect file, check for exceptions file"
)
logging.debug(f"Appinspect failures: {failures}")
logging.debug(f"Expected failures: {expected}")
raise AppinspectFailures
Expand Down Expand Up @@ -252,7 +249,13 @@ def compare_against_known_failures(response_json: Dict[str, Any], exceptions_fil

if exceptions_file_path.exists():
expected_failures = list(read_yaml_as_dict(exceptions_file_path).keys())
compare_failures(failures, expected_failures)
try:
compare_failures(failures, expected_failures)
except AppinspectFailures:
logging.error(
"Appinspect failures doesn't match appinspect.expect file, check for exceptions file"
mbruzda-splunk marked this conversation as resolved.
Show resolved Hide resolved
)
sys.exit(1)
else:
logging.error(
f"File `{exceptions_file_path.name}` not found, please create `{exceptions_file_path.name}` file with exceptions\n" # noqa: E501
Expand Down
2 changes: 1 addition & 1 deletion test/unit/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ def test_compare_known_failures_no_exceptions(tmp_path):
exceptions_file = tmp_path / "foo.yaml"
exceptions_file.write_text(exceptions_content)

with pytest.raises(main.AppinspectFailures):
with pytest.raises(SystemExit):
main.compare_against_known_failures(response_json, exceptions_file)


Expand Down