nose-devs/nose — Issue #118: case sensitive file path comparison in Importer.sameModule() can cause modules to be loaded twice on Windows
Author: jpellerin
Created: 2011-12-14 15:59:50+00:00
State: open

What steps will reproduce the problem?

1. create a new virtualenv on Windows. MAKE SURE there is an uppercase letter in the path.
2. checkout this package: https://bitbucket.org/rsyring/nose-import-bug-example
3. Activiate venv
4. python setup.py develop
5. cd bwimpt
6. nosetests -s tests/test_import.py

On Linux, you will see something like the following:

id from app 31207560
from test 31207560
id from app 31207560

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK

On Windows, you will see that the app ids are not the same and will get an assertion error.

What version of the product are you using? On what operating system?

Versions: both 0.11.4 and tip as of 11/22/10
OS: Linux & Windows, but the problem only shows up on Windows

Please provide any additional information below.

If you use a fix for issue #293 and use the --first-package-wins option, this bug disappears.

I believe I have tracked the problem down to the code in importer.py that replaces modules. It uses Importer.sameModule() which is using a comparison of file paths that is case sensitive.

My fix is here: https://bitbucket.org/rsyring/blaze-nose/changeset/703767dd9288

FWIW, IMO, this is a pretty significant bug. The result in my application during testing was that 'import foo.bar' would fail with the message that module foo did not have an attribute bar. But we knew the paths were correct b/c the same code worked in production and during testing when using Linux systems. Whats worse was that it just didn't make sense...it took us several days to finally minimalize the test case enough to figure out it was a bug in Nose.

Thanks for your work on this project, I have really gotten into unit & functional testing since I came into contact with nose and have appreciated its flexibility and utility.

Google Code Info:
Issue #: 376
Author: rsyr...@gmail.com
Created On: 2010-11-23T06:53:03.000Z
Closed On: