diff --git a/src/pytkdocs/loader.py b/src/pytkdocs/loader.py index 2f29467..2c402a8 100644 --- a/src/pytkdocs/loader.py +++ b/src/pytkdocs/loader.py @@ -410,7 +410,6 @@ def get_module_documentation(self, node: ObjectNode, select_members=None) -> Mod try: code = Path(node.file_path).read_text() except (OSError, UnicodeDecodeError): - self.errors.append(f"Couldn't read source for '{path}': {error}") source = None else: source = Source(code, 1) if code else None @@ -628,13 +627,11 @@ def get_function_documentation(self, node: ObjectNode) -> Function: try: signature = inspect.signature(function) except TypeError as error: - self.errors.append(f"Couldn't get signature for '{path}': {error}") signature = None try: source = Source(*inspect.getsourcelines(function)) except OSError as error: - self.errors.append(f"Couldn't read source for '{path}': {error}") source = None properties: List[str] = [] @@ -677,7 +674,6 @@ def get_property_documentation(self, node: ObjectNode) -> Attribute: try: signature = inspect.signature(sig_source_func) except (TypeError, ValueError) as error: - self.errors.append(f"Couldn't get signature for '{path}': {error}") attr_type = None else: attr_type = signature.return_annotation @@ -685,7 +681,6 @@ def get_property_documentation(self, node: ObjectNode) -> Attribute: try: source = Source(*inspect.getsourcelines(sig_source_func)) except (OSError, TypeError) as error: - self.errors.append(f"Couldn't get source for '{path}': {error}") source = None return Attribute( @@ -879,7 +874,6 @@ def get_method_documentation(self, node: ObjectNode, properties: Optional[List[s try: source = Source(*inspect.getsourcelines(method)) except OSError as error: - self.errors.append(f"Couldn't read source for '{path}': {error}") source = None except TypeError: source = None @@ -898,7 +892,6 @@ def get_method_documentation(self, node: ObjectNode, properties: Optional[List[s # raise a ValueError(). signature = inspect.signature(method) except ValueError as error: - self.errors.append(f"Couldn't read signature for '{path}': {error}") signature = None return Method( diff --git a/tests/test_loader.py b/tests/test_loader.py index 4af308d..9c8d98a 100644 --- a/tests/test_loader.py +++ b/tests/test_loader.py @@ -116,16 +116,7 @@ def test_inheriting_typing_NamedTuple(): """ loader = Loader() loader.get_object_documentation("tests.fixtures.inheriting_typing_NamedTuple") - - if sys.version_info > (3, 7, 99): - assert len(loader.errors) == 1 - else: - # there are 4 class-attributes, 2 errors (source, signature) per attribute - assert len(loader.errors) >= 8 - for error in loader.errors[-8:]: - assert "itemgetter" in error - for error in loader.errors[:-8]: - assert "could not get source code" in error + assert len(loader.errors) == 0 def test_nested_class():