diff --git a/pyproject.toml b/pyproject.toml index b1065fe6..0e76a5ee 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -52,6 +52,26 @@ preview = true [tool.coverage.report] skip_empty = true +# Subset of rules from https://pypi.org/project/covdefaults/ +exclude_lines = [ + # a more strict default pragma + "# pragma: no cover\\b", + + # allow defensive code + "^\\s*raise AssertionError\\b", + "^\\s*raise NotImplementedError\\b", + "^\\s*return NotImplemented\\b", + "^\\s*raise$", + + # typing-related code + "^\\s*if (False|TYPE_CHECKING):", + ": \\.\\.\\.(\\s*#.*)?$", + "^ +\\.\\.\\.$", + "-> ['\"]?NoReturn['\"]?:", + + # non-runnable code + "if __name__ == ['\"]__main__['\"]:$", +] [tool.coverage.run] branch = true