Skip to content

Commit

Permalink
test: handle clang diagnostics returning None for filename
Browse files Browse the repository at this point in the history
The parser may return None for clang diagnostics filename if there isn't
one. Handle it gracefully.
  • Loading branch information
jnikula committed Sep 1, 2024
1 parent 8e9ea0b commit f86b230
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ def get_output(self):
roots[key] = root

for error in errors:
errors_str += f'{error.level.name}: {os.path.basename(error.filename)}:{error.line}: {error.message}\n' # noqa: E501
filename = os.path.basename(error.filename) if error.filename else ''
errors_str += f'{error.level.name}: {filename}:{error.line}: {error.message}\n' # noqa: E501

for directive in self.directives:
filename = directive.get_input_filename()
Expand Down

0 comments on commit f86b230

Please sign in to comment.