Skip to content

Nose incorrectly reloads a module during test finding #383

@jpellerin

Description

@jpellerin

What steps will reproduce the problem?

  1. Unpack the attached <noseimportbug.tgz> 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:

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions