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. We already handle this gracefully in get_message(), so reuse that
instead of duplicating the logic, now that there's support for
basename=True.
  • Loading branch information
jnikula committed Sep 12, 2024
1 parent 523d8ea commit 0a196b2
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions test/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# Copyright (c) 2018-2023, Jani Nikula <[email protected]>
# Licensed under the terms of BSD 2-Clause, see LICENSE for details.

import os

import pytest

from hawkmoth import docstring
Expand Down Expand Up @@ -81,7 +79,7 @@ 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
errors_str += f'{error.level.name}: {error.get_message(basename=True)}\n'

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

0 comments on commit 0a196b2

Please sign in to comment.