You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
setup.py test fails with a confusing exception if the test suite is a "py3 native" namespace package (no __init__.py).
Reproducer
setup.py:
from setuptools import setup
setup(name='reproducer',
version='0.0',
test_suite='tests',
)
tests is an empty directory (it might have some tests, but no __init__.py)
Run python setup.py test
Result
Traceback (most recent call last):
File ".../setup.py", line 3, in <module>
setup(name='reproducer',
...
File ".../unittest/loader.py", line 220, in loadTestsFromNames
suites = [self.loadTestsFromName(name, module) for name in names]
...
File ".../setuptools/command/test.py", line 47, in loadTestsFromModule
for file in resource_listdir(module.__name__, ''):
File ".../pkg_resources/__init__.py", line 1162, in resource_listdir
return get_provider(package_or_requirement).resource_listdir(
File ".../pkg_resources/__init__.py", line 364, in get_provider
return _find_adapter(_provider_factories, loader)(module)
File ".../site-packages/pkg_resources/__init__.py", line 1392, in __init__
self.module_path = os.path.dirname(getattr(module, '__file__', ''))
File ".../posixpath.py", line 152, in dirname
p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType
I know pkg_resources is being deprecated in favor of importlib.resources, but ... this is setuptools itself using it.
I'm also aware there are better alternatives to setup.py test (but if the official position is "don't use it", I'd welcome a statement from setuptools maintainers saying that, so I can link people to it).
Filing this mostly to let you know. I don't really mind if this isn't fixed.
The text was updated successfully, but these errors were encountered:
I'm also aware there are better alternatives to setup.py test (but if the official position is "don't use it", I'd welcome a statement from setuptools maintainers saying that, so I can link people to it).
The official position is indeed "don't use it", we just need to implement the "statement" part. For now you can link to #931 and #1684.
setup.py test
fails with a confusing exception if the test suite is a "py3 native" namespace package (no__init__.py
).Reproducer
setup.py
:tests
is an empty directory (it might have some tests, but no__init__.py
)Run
python setup.py test
Result
I know pkg_resources is being deprecated in favor of importlib.resources, but ... this is setuptools itself using it.
I'm also aware there are better alternatives to
setup.py test
(but if the official position is "don't use it", I'd welcome a statement from setuptools maintainers saying that, so I can link people to it).Filing this mostly to let you know. I don't really mind if this isn't fixed.
The text was updated successfully, but these errors were encountered: