pdoc3 / pdoc

:snake: :arrow_right: :scroll: Auto-generate API documentation for Python projects
https://pdoc3.github.io/pdoc/
GNU Affero General Public License v3.0
1.14k stars 146 forks source link

test_Class_params fails in the released 0.10.0 version #355

Closed catern closed 3 years ago

catern commented 3 years ago

Expected Behavior

All tests pass - they were run as part of this package update: https://github.com/NixOS/nixpkgs/pull/135261

Actual Behavior

test_Class_params fails with

======================================================================
FAIL: test_Class_params (pdoc.test.ApiTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/pdoc3-0.10.0/pdoc/test/__init__.py", line 100, in wrapper
    func(*args, **kwargs)
  File "/build/pdoc3-0.10.0/pdoc/test/__init__.py", line 1055, in test_Class_params
    self.assertEqual(pdoc.Class('G2', mod, G2).params(), ['*args', '**kwds'])
AssertionError: Lists differ: [] != ['*args', '**kwds']

Second list contains 2 additional elements.
First extra element 0:
'*args'

- []
+ ['*args', '**kwds']

Steps to Reproduce

Run the tests on version 0.10.0 on PyPI. We're doing through python setup.py test.

Additional info

catern commented 3 years ago

This test failure was introduced in commit d68abccc5b616917a092ba2b940dd96112090826 and is present in CPython 3.9 and not present in CPython 3.8.

catern commented 3 years ago

Which was introduced by PR #242 - @RaduG do you know what might be the right fix for this test failure?

RaduG commented 3 years ago

Hi @catern, this issue is caused by Python's typing.Generic class:

The fix would be to stop using typing.Generic as a base and just create a base class that implements __new__. This does not affect the functionality in the PR, it's just a test detail. Happy to address this.