twisted / pydoctor

This is pydoctor, an API documentation generator that works by static analysis.
https://pydoctor.readthedocs.io
Other
179 stars 48 forks source link

Missing test dependencies: hypothesis #753

Closed buhtz closed 6 months ago

buhtz commented 6 months ago

I installed via --editable and got this error message.

=========================================================== ERRORS ============================================================
________________________________________ ERROR collecting pydoctor/test/test_sphinx.py ________________________________________
ImportError while importing test module '/home/user/ownCloud/my.work/pydoctor/pydoctor/test/test_sphinx.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.9/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
pydoctor/test/test_sphinx.py:18: in <module>
    from hypothesis import assume, given, settings
E   ModuleNotFoundError: No module named 'hypothesis'
=================================================== short test summary info ===================================================

There is no pyproject.toml and also in the setup.* file I can not see a dedicated install target (e.g. python3 -m pip install -e .[dev]).

Hypothesis should be a dependency.

tristanlatr commented 6 months ago

This requirement is installed through tox. I agree it should be listed in the setup.cfg under the test requirements, but for the short term: can you use tox to run tests ?

buhtz commented 6 months ago

can you use tox to run tests ?

Describe in the docu how and then I can. I don't like tox and don't think this is something external contributors should be bothered with. But it is your decision as upstream maintainer. But part of your decision then should be documented. Do not expect that contributors know what tox is or know how to use it. It would be easier for all of us if you would stick to default-vanilla Python build system. You can use tox/poetry/fancy-xyz in your CI or your not-public build machine.

And I don't trust your tox config. Even your vanilla unit tests do use the real filesystem. How does tox mess up my system then?

Your tox do not work out of the box. See #755.

tristanlatr commented 6 months ago

Ok lets move the test dependencies out of the tox config so tests can by simply be run with pytest.

tristanlatr commented 6 months ago

it looks like all the test dependencies are already liste in the test extras: https://github.com/twisted/pydoctor/blob/662eafaedcdfcfa0c5a83c1048c28f187fbcf4c9/setup.cfg#L64C6-L64C6

so it’s just a matter of installing the test extra and documenting this process.