aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/command/test.py
diff options
context:
space:
mode:
authorBenoit Pierre <benoit.pierre@gmail.com>2017-06-26 16:33:36 +0200
committerBenoit Pierre <benoit.pierre@gmail.com>2017-11-02 20:44:47 +0100
commitdbff2e7ed421be9ec96029366479a8627691e7f3 (patch)
tree0dc4c56e861c46b2fc48656f22b53733423a390b /setuptools/command/test.py
parent84093b78ec61ad47a2a0dea9f1be8d94fa0d485e (diff)
downloadexternal_python_setuptools-dbff2e7ed421be9ec96029366479a8627691e7f3.tar.gz
external_python_setuptools-dbff2e7ed421be9ec96029366479a8627691e7f3.tar.bz2
external_python_setuptools-dbff2e7ed421be9ec96029366479a8627691e7f3.zip
fix `test` command running tests twice
Diffstat (limited to 'setuptools/command/test.py')
-rw-r--r--setuptools/command/test.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/setuptools/command/test.py b/setuptools/command/test.py
index 523407fd..bfa71496 100644
--- a/setuptools/command/test.py
+++ b/setuptools/command/test.py
@@ -18,6 +18,11 @@ from setuptools.py31compat import unittest_main
class ScanningLoader(TestLoader):
+
+ def __init__(self):
+ TestLoader.__init__(self)
+ self._visited = set()
+
def loadTestsFromModule(self, module, pattern=None):
"""Return a suite of all tests cases contained in the given module
@@ -25,6 +30,10 @@ class ScanningLoader(TestLoader):
If the module has an ``additional_tests`` function, call it and add
the return value to the tests.
"""
+ if module in self._visited:
+ return None
+ self._visited.add(module)
+
tests = []
tests.append(TestLoader.loadTestsFromModule(self, module))
@@ -101,7 +110,7 @@ class test(Command):
return list(self._test_args())
def _test_args(self):
- if not self.test_suite:
+ if not self.test_suite and sys.version_info >= (2, 7):
yield 'discover'
if self.verbose:
yield '--verbose'