summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Szakmeister <john@szakmeister.net>2015-10-21 04:11:49 -0400
committerJohn Szakmeister <john@szakmeister.net>2015-10-21 04:11:49 -0400
commit6d2b14634775778e95df1c057b404108b9db036a (patch)
tree4964851c4037b59757ebe67bbe552875236790d9
parentd6642085a87cece41edc3808749f68d7b9a5ecd9 (diff)
parent9ccf568e7f7a8c48d235e779f2add2481859d81c (diff)
downloadnose-6d2b14634775778e95df1c057b404108b9db036a.tar.gz
Merge pull request #957 from jszakmeister/fix-931
Fix #931: duplicate __init__ modules can be picked up
-rw-r--r--functional_tests/test_loader.py5
-rw-r--r--nose/loader.py4
2 files changed, 7 insertions, 2 deletions
diff --git a/functional_tests/test_loader.py b/functional_tests/test_loader.py
index 81aaa7b..104f220 100644
--- a/functional_tests/test_loader.py
+++ b/functional_tests/test_loader.py
@@ -5,6 +5,7 @@ from difflib import ndiff
from cStringIO import StringIO
from nose.config import Config
+from nose.plugins.allmodules import AllModules
from nose.plugins.manager import PluginManager
from nose.plugins.skip import Skip
from nose import loader
@@ -64,9 +65,11 @@ class TestNoseTestLoader(unittest.TestCase):
self.assertEqual(res.testsRun, 1)
def test_fixture_context(self):
+ config = Config(ignoreFiles=[],
+ plugins=PluginManager(plugins=[AllModules()]))
res = unittest.TestResult()
wd = os.path.join(support, 'package2')
- l = loader.TestLoader(workingDir=wd)
+ l = loader.TestLoader(config=config, workingDir=wd)
dir_suite = l.loadTestsFromName('.')
dir_suite(res)
diff --git a/nose/loader.py b/nose/loader.py
index 3744e54..a579372 100644
--- a/nose/loader.py
+++ b/nose/loader.py
@@ -21,7 +21,7 @@ from nose.config import Config
from nose.importer import Importer, add_path, remove_path
from nose.selector import defaultSelector, TestAddress
from nose.util import func_lineno, getpackage, isclass, isgenerator, \
- ispackage, regex_last_key, resolve_name, transplant_func, \
+ ispackage, regex_last_key, resolve_name, src, transplant_func, \
transplant_class, test_address
from nose.suite import ContextSuiteFactory, ContextList, LazySuite
from nose.pyversion import sort_list, cmp_to_key
@@ -153,6 +153,8 @@ class TestLoader(unittest.TestLoader):
# http://code.google.com/p/python-nose/issues/detail?id=82
if entry.startswith('.'):
continue
+ if src(entry) == '__init__.py':
+ continue
entry_path = op_abspath(op_join(path, entry))
is_file = op_isfile(entry_path)
wanted = False