diff options
author | Robert Collins <robertc@robertcollins.net> | 2011-08-22 11:18:04 +1200 |
---|---|---|
committer | Robert Collins <robertc@robertcollins.net> | 2011-08-22 11:18:04 +1200 |
commit | a1e8a04e70a6717f8e6d6eb42428422c8a92d934 (patch) | |
tree | 86fa47f83767c8fa66f6149e97a973c87f1518c3 | |
parent | 4fdb9f5f924d2166daa438fde82e232d643cf613 (diff) | |
download | fixtures-a1e8a04e70a6717f8e6d6eb42428422c8a92d934.tar.gz |
* On Python 2.7 and above the _fixtures tests are no longer run twice.
(Robert Collins)
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | lib/fixtures/tests/__init__.py | 9 |
2 files changed, 10 insertions, 2 deletions
@@ -8,6 +8,9 @@ IN DEVELOPMENT CHANGES: +* On Python 2.7 and above the _fixtures tests are no longer run twice. + (Robert Collins) + * Python 3 now supported. (Jonathan Lange, #816665) * Updated to match the changed ``gather_details`` API in testtools. See #801027. diff --git a/lib/fixtures/tests/__init__.py b/lib/fixtures/tests/__init__.py index dfa4432..9059073 100644 --- a/lib/fixtures/tests/__init__.py +++ b/lib/fixtures/tests/__init__.py @@ -35,8 +35,13 @@ def load_tests(loader, standard_tests, pattern): prefix = "fixtures.tests.test_" test_mod_names = [prefix + test_module for test_module in test_modules] standard_tests.addTests(loader.loadTestsFromNames(test_mod_names)) - standard_tests.addTests(fixtures.tests._fixtures.load_tests( - loader, loader.loadTestsFromName('fixtures.tests._fixtures'), pattern)) + if sys.version_info >= (2, 7): + # 2.7 calls load_tests for us + standard_tests.addTests(loader.loadTestsFromName('fixtures.tests._fixtures')) + else: + # We need to call it ourselves. + standard_tests.addTests(fixtures.tests._fixtures.load_tests( + loader, loader.loadTestsFromName('fixtures.tests._fixtures'), pattern)) doctest.set_unittest_reportflags(doctest.REPORT_ONLY_FIRST_FAILURE) standard_tests.addTest(doctest.DocFileSuite("../../../README")) return standard_tests |