gh-106368: Improve coverage reports for argument clinic (#107693)
This commit is contained in:
parent
9564e31cbc
commit
ee3bf45e5e
@ -7,6 +7,11 @@ exclude_lines =
|
|||||||
# Don't complain if non-runnable code isn't run:
|
# Don't complain if non-runnable code isn't run:
|
||||||
if 0:
|
if 0:
|
||||||
if __name__ == .__main__.:
|
if __name__ == .__main__.:
|
||||||
|
raise AssertionError\(
|
||||||
|
|
||||||
|
# Empty bodies in protocols or abstract methods
|
||||||
|
^\s*def [a-zA-Z0-9_]+\(.*\)(\s*->.*)?:\s*\.\.\.(\s*#.*)?$
|
||||||
|
^\s*\.\.\.(\s*#.*)?$
|
||||||
|
|
||||||
.*# pragma: no cover
|
.*# pragma: no cover
|
||||||
.*# pragma: no branch
|
.*# pragma: no branch
|
||||||
|
@ -469,7 +469,7 @@ class Language(metaclass=abc.ABCMeta):
|
|||||||
checksum_line = ""
|
checksum_line = ""
|
||||||
|
|
||||||
def __init__(self, filename: str) -> None:
|
def __init__(self, filename: str) -> None:
|
||||||
pass
|
...
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def render(
|
def render(
|
||||||
@ -477,10 +477,10 @@ class Language(metaclass=abc.ABCMeta):
|
|||||||
clinic: Clinic | None,
|
clinic: Clinic | None,
|
||||||
signatures: Iterable[Module | Class | Function]
|
signatures: Iterable[Module | Class | Function]
|
||||||
) -> str:
|
) -> str:
|
||||||
pass
|
...
|
||||||
|
|
||||||
def parse_line(self, line: str) -> None:
|
def parse_line(self, line: str) -> None:
|
||||||
pass
|
...
|
||||||
|
|
||||||
def validate(self) -> None:
|
def validate(self) -> None:
|
||||||
def assert_only_one(
|
def assert_only_one(
|
||||||
@ -2862,6 +2862,9 @@ class CConverter(metaclass=CConverterAutoRegister):
|
|||||||
f"Note: accessing self.function inside converter_init is disallowed!"
|
f"Note: accessing self.function inside converter_init is disallowed!"
|
||||||
)
|
)
|
||||||
return super().__getattr__(attr)
|
return super().__getattr__(attr)
|
||||||
|
# this branch is just here for coverage reporting
|
||||||
|
else: # pragma: no cover
|
||||||
|
pass
|
||||||
|
|
||||||
def converter_init(self) -> None:
|
def converter_init(self) -> None:
|
||||||
pass
|
pass
|
||||||
@ -3990,7 +3993,7 @@ def correct_name_for_self(
|
|||||||
return "void *", "null"
|
return "void *", "null"
|
||||||
if f.kind in (CLASS_METHOD, METHOD_NEW):
|
if f.kind in (CLASS_METHOD, METHOD_NEW):
|
||||||
return "PyTypeObject *", "type"
|
return "PyTypeObject *", "type"
|
||||||
raise RuntimeError("Unhandled type of function f: " + repr(f.kind))
|
raise AssertionError(f"Unhandled type of function f: {f.kind!r}")
|
||||||
|
|
||||||
def required_type_for_self_for_parser(
|
def required_type_for_self_for_parser(
|
||||||
f: Function
|
f: Function
|
||||||
|
@ -178,11 +178,17 @@ class Monitor:
|
|||||||
if self.verbose:
|
if self.verbose:
|
||||||
print(self.status())
|
print(self.status())
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
for filename in sys.argv[1:]:
|
def _main(filenames: list[str] | None = None) -> None:
|
||||||
|
filenames = filenames or sys.argv[1:]
|
||||||
|
for filename in filenames:
|
||||||
with open(filename) as f:
|
with open(filename) as f:
|
||||||
cpp = Monitor(filename, verbose=True)
|
cpp = Monitor(filename, verbose=True)
|
||||||
print()
|
print()
|
||||||
print(filename)
|
print(filename)
|
||||||
for line_number, line in enumerate(f.read().split('\n'), 1):
|
for line_number, line in enumerate(f.read().split('\n'), 1):
|
||||||
cpp.writeline(line)
|
cpp.writeline(line)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
_main()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user