nose-devs / nose

nose is nicer testing for python
http://readthedocs.org/docs/nose/en/latest/
1.36k stars 395 forks source link

Test names incorrectly reported on Py3 (folders are not processed as packages) #1042

Open throwable-one opened 7 years ago

throwable-one commented 7 years ago

I have the following structure

└───test_package
    └───__init__.py
    └───test_module__.py
    └─────def test_test

I launch nosetests --verbose and it says test_package.test_module.test_test ... ok

So far so good.

But once I delete __init__.py it reports test_module.test_test ... ok like test_package is not package anymore. Well, it is true for Py2 but not in Py3! I can do from test_package import test_module in Py3.

So, nose acts as like it is Py2 even for Py3.

jszakmeister commented 7 years ago

Correct. Python 3's namespace packages don't play well with Nose. The short form is that Nose is only trying to discover Python-related bits and it does so by looking for __init__.py. The introduction of namespace packages makes the discovery process hard--it's hard to tell when something is actual package and when it's just a lone script meant to be left alone.

Either way, Nose is currently unmaintained. So unless someone steps up to take over maintainership, this will remain an issue.