Author ashkop
Recipients Florian.Apolloner, ashkop, eric.snow, ezio.melotti, michael.foord, rbcollins
Date 2015-04-08.09:57:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1428487073.51.0.512112062359.issue23882@psf.upfronthosting.co.za>
In-reply-to
Content
Spent some time looking into this one. Looks like the problem is in TestLoader.discover() method. There are couple of issues I found in it, all caused by same assumption.

Documentation [1] states that all test modules found by discover() method should be importable from top_level_dir. Whenever this method finds a subdirectory of start_dir it checks for __init__.py file. If there's no __init__.py then finder assumes that files within this package is not importable and stops recursion. This kind of 'importablity' check is not valid since we have namespace packages.

I'm not sure what should be done to fix this issue. We can change documentation to state that only regular packages with tests will be discovered. Or we can fix 'importability' checks, which will mean that all tests in all subdirectories will be discovered.

[1] https://docs.python.org/3.4/library/unittest.html#unittest.TestLoader.discover
History
Date User Action Args
2015-04-08 09:57:53ashkopsetrecipients: + ashkop, rbcollins, ezio.melotti, michael.foord, eric.snow, Florian.Apolloner
2015-04-08 09:57:53ashkopsetmessageid: <1428487073.51.0.512112062359.issue23882@psf.upfronthosting.co.za>
2015-04-08 09:57:53ashkoplinkissue23882 messages
2015-04-08 09:57:53ashkopcreate