[issue23882] unittest discovery and namespaced packages

2015-04-20 Thread Alex Shkop

Alex Shkop added the comment:

This script creates following directory structure

issue_23882\
  tests\
test_fail.py

If you run from issue_23882 directory

python -m unittest

it doesn't find any tests. If there is __init__.py inside tests folder, same 
command finds test_fail.py and runs it.

I'm not sure yet about using pkgutil cause looks like iter_modules and 
walk_packages do not find namespace packages as well.

--
Added file: http://bugs.python.org/file39142/issue_23882_test_case.sh

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23882
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23882] unittest discovery and namespaced packages

2015-04-17 Thread Claudiu Popa

Claudiu Popa added the comment:

Isn't this already supported by the patch added in issue17457?

--
nosy: +Claudiu.Popa

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23882
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23882] unittest discovery and namespaced packages

2015-04-17 Thread Alex Shkop

Alex Shkop added the comment:

Not fully. Patch for issue17457 fixed discovery when you explicitly specified 
namespace package as a target for discovery. I.e. when you run

python -m unittest namespace_pkg

But it didn't recurse into any namespace packages inside namespace_pkg. So when 
you run

python -m unittest

it doesn't go under all namespace packages (basically folders) in cwd.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23882
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23882] unittest discovery and namespaced packages

2015-04-17 Thread Robert Collins

Robert Collins added the comment:

Hi. I'd be happy enough to use pkgutil helpers if they (like walkdirs) allowed 
trimming the output: part of the definition of discovery is that one can 
control it, to stop it importing or processing part of the tree that one 
doesn't want processed.

Alex: can you create a test case please - just a small script, python or shell 
or whatever, that will setup a demonstration of the bug? Thanks.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23882
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23882] unittest discovery and namespaced packages

2015-04-08 Thread Alex Shkop

Alex Shkop added the comment:

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

--
nosy: +ashkop

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23882
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23882] unittest discovery and namespaced packages

2015-04-08 Thread Eric Snow

Eric Snow added the comment:

Is there any reason for unittest to not use pkgutil.iter_modules or 
pkgutil.walk_packages?  Either should work.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23882
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23882] unittest discovery and namespaced packages

2015-04-07 Thread Florian Apolloner

New submission from Florian Apolloner:

Unittest discovery does not seem to work if the tests package is  a namespace 
package. The attached file should have all details to reproduce, as soon as I 
readd an __init__.py everything works fine. 

Test was done using python3.4.2 and 3.4.3

--
files: console_log.txt
messages: 240205
nosy: Florian.Apolloner
priority: normal
severity: normal
status: open
title: unittest discovery and namespaced packages
versions: Python 3.4
Added file: http://bugs.python.org/file38857/console_log.txt

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23882
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23882] unittest discovery and namespaced packages

2015-04-07 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +ezio.melotti, michael.foord, rbcollins
type:  - behavior

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23882
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23882] unittest discovery and namespaced packages

2015-04-07 Thread Eric Snow

Changes by Eric Snow ericsnowcurren...@gmail.com:


--
nosy: +eric.snow

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23882
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com