nose-devs/nose — Issue #383: Nose incorrectly reloads a module during test finding
Author: jpellerin
Created: 2011-12-14 16:09:36+00:00
State: open

What steps will reproduce the problem?
1. Unpack the attached file
2. Run it with "python -m run -v --with-doctest" (in the noseimportbug directory)
3. The test failes with: AttributeError: 'NoneType' object has no attribute 'path'

What is the expected output? What do you see instead?
Expected the test to succeed as the code only calls "sys.path". However
the imported module has been set to "None"

What version of the product are you using? On what operating system?
* nose version 0.11.1
* linux and OS X

Please provide any additional information below.
The nose imported reloads a module, this is fine for test modules but
for code modules with dependencies it may fail.

In this test case the module should not even be reloaded. The nose importer
incorrectly determines the module to be not the same as the file.

In the Importer class of the "nose.importer", the "sameModule" method now has a line:

new_path = os.path.dirname(os.path.normpath(filename))

This should probably be replaced with:

new_path = os.path.dirname(os.path.normpath(os.abspath(filename)))

As it is compared with absolute paths.

Google Code Info:
Issue #: 356
Author: post4ar...@gmail.com
Created On: 2010-07-29T11:06:26.000Z
Closed On: