[Python-checkins] distutils2: tests-require moved to be an option of test command

tarek.ziade python-checkins at python.org
Sun Sep 19 10:20:22 CEST 2010


tarek.ziade pushed 75019e7abbc9 to distutils2:

http://hg.python.org/distutils2/rev/75019e7abbc9
changeset:   626:75019e7abbc9
user:        Konrad Delong <konryd at gmail.com>
date:        Sat Aug 14 23:28:01 2010 +0200
summary:     tests-require moved to be an option of test command
files:       src/distutils2/command/test.py, src/distutils2/dist.py, src/distutils2/tests/test_test.py

diff --git a/src/distutils2/command/test.py b/src/distutils2/command/test.py
--- a/src/distutils2/command/test.py
+++ b/src/distutils2/command/test.py
@@ -16,19 +16,21 @@
             "Test suite to run (e.g. 'some_module.test_suite')"),
         ('runner=', None,
             "Test runner to be called."),
+        ('tests-require=', None,
+            "List of packages required to run the test suite."),
     ]
 
     def initialize_options(self):
         self.suite = None
         self.runner = None
+        self.tests_require = []
 
     def finalize_options(self):
         self.build_lib = self.get_finalized_command("build").build_lib
-        if self.distribution.tests_require:
-            for requirement in self.distribution.tests_require:
-                if get_distribution(requirement) is None:
-                    warnings.warn("The test dependency %s is not installed which may couse the tests to fail." % requirement,
-                                  RuntimeWarning)
+        for requirement in self.tests_require:
+            if get_distribution(requirement) is None:
+                warnings.warn("The test dependency %s is not installed which may couse the tests to fail." % requirement,
+                              RuntimeWarning)
         if not self.suite and not self.runner and self.get_ut_with_discovery() is None:
             self.announce("No test discovery available. Please specify the 'suite' or 'runner' option or install unittest2.", log.ERROR)
     
diff --git a/src/distutils2/dist.py b/src/distutils2/dist.py
--- a/src/distutils2/dist.py
+++ b/src/distutils2/dist.py
@@ -108,8 +108,6 @@
          "print the list of packages/modules provided"),
         ('requires', None,
          "print the list of packages/modules required"),
-        ('tests-require', None,
-         "print the list of packages/modules required to run the test suite"),
         ('obsoletes', None,
          "print the list of packages/modules made obsolete"),
         ('use-2to3', None,
diff --git a/src/distutils2/tests/test_test.py b/src/distutils2/tests/test_test.py
--- a/src/distutils2/tests/test_test.py
+++ b/src/distutils2/tests/test_test.py
@@ -62,7 +62,6 @@
     return wrapper
 
 class TestTest(TempdirManager,
-               #LoggingSilencer,
                unittest.TestCase):
 
     def setUp(self):
@@ -123,9 +122,9 @@
     def test_checks_requires(self):
         from distutils2.tests.with_support import examine_warnings
         dist = Distribution()
-        dist.tests_require = ['ohno_ohno-impossible_1234-name_stop-that!']
         cmd = test(dist)
         def examinator(ws):
+            cmd.tests_require = ['ohno_ohno-impossible_1234-name_stop-that!']
             cmd.ensure_finalized()
             self.assertEqual(1, len(ws))
             warning = ws[0]

--
Repository URL: http://hg.python.org/distutils2


More information about the Python-checkins mailing list