Opened 7 years ago

Closed 7 years ago

#5021 defect closed duplicate (duplicate)

Trial runs tests multiple times when using namespace packages

Reported by: nkvoll Owned by:
Priority: normal Milestone:
Component: trial Keywords:
Cc: Jonathan Lange Branch:
Author:

Description

The attach project declares two namespace packages. "project_name" and "project_name.contrib". A subproject (in contrib/) adds a test_subproject.py file to project_name.contrib. This results in trial running the test twice, even though the module is only loaded once.

How to reproduce: unpack the attached example and do the following:

# create a project_name.egg-info directory:
$ python setup.py develop

# ensure that sys.path includes the master project, and a contrib sub-project
$ export PYTHONPATH=`pwd`:`pwd`/contrib/subproject

# run trial
trial project_name

Attachments (4)

reproduce.tar.gz (1.4 KB) - added by nkvoll 7 years ago.
small example
reproduce-multiple.tar.gz (1.9 KB) - added by nkvoll 7 years ago.
showing that tests are run n+1 times where n is the number of subprojects
trial-namespace.patch (557 bytes) - added by nkvoll 7 years ago.
suggested fix
trial-namespace.2.patch (1009 bytes) - added by nkvoll 7 years ago.
suggested fix

Download all attachments as: .zip

Change History (8)

comment:1 Changed 7 years ago by DefaultCC Plugin

Cc: Jonathan Lange added

Changed 7 years ago by nkvoll

Attachment: reproduce.tar.gz added

small example

comment:2 Changed 7 years ago by nkvoll

If n sub-projects are used, all the tests under e.g project_name.contrib will be executed n+1 times.

Changed 7 years ago by nkvoll

Attachment: reproduce-multiple.tar.gz added

showing that tests are run n+1 times where n is the number of subprojects

Changed 7 years ago by nkvoll

Attachment: trial-namespace.patch added

suggested fix

comment:3 Changed 7 years ago by nkvoll

Forgot to add the code that enabled PythonModules to be used in hashable collections. Attaching a new patch now.

Changed 7 years ago by nkvoll

Attachment: trial-namespace.2.patch added

suggested fix

comment:4 Changed 7 years ago by nkvoll

Resolution: duplicate
Status: newclosed

#5030 addresses this issue.

Note: See TracTickets for help on using tickets.