[New-bugs-announce] [issue8547] unittest test discovery can fail when package under test is also installed globally

Michael Foord report at bugs.python.org
Tue Apr 27 14:23:19 CEST 2010


New submission from Michael Foord <michael at 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 <report at bugs.python.org>
<http://bugs.python.org/issue8547>
_______________________________________


More information about the New-bugs-announce mailing list