New submission from Michael Foord <mich...@voidspace.org.uk>:

When test discovery is invoked on a package on the filesystem which is also 
installed in site-packages then importing the tests will look in the installed 
version. This causes discovery to run the wrong tests or fail.

We can detect this (compare the __file__ against the expected location) and 
also insert the top level path as the first location in sys.path instead of 
appending it to the end.

If we detect a failed import then we should error out with an appropriate 
message.

(Nose gets round this by patching __import__ to import from a specific location 
which seems potentially fragile.)

----------
assignee: michael.foord
components: Library (Lib)
messages: 104313
nosy: michael.foord
priority: normal
severity: normal
stage: needs patch
status: open
title: unittest test discovery can fail when package under test is also 
installed globally
type: behavior
versions: Python 2.7, Python 3.2

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue8547>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to