[Python-checkins] distutils2: improved test coverage

tarek.ziade python-checkins at python.org
Sun May 30 00:05:49 CEST 2010


tarek.ziade pushed 7527c6f89b67 to distutils2:

http://hg.python.org/distutils2/rev/7527c6f89b67
changeset:   169:7527c6f89b67
user:        Yannick Gingras <ygingras at ygingras.net>
date:        Sun May 23 02:14:41 2010 -0400
summary:     improved test coverage
files:       src/distutils2/tests/test_core.py, src/distutils2/tests/test_version.py

diff --git a/src/distutils2/tests/test_core.py b/src/distutils2/tests/test_core.py
--- a/src/distutils2/tests/test_core.py
+++ b/src/distutils2/tests/test_core.py
@@ -60,6 +60,19 @@
         distutils2.core.run_setup(
             self.write_setup(setup_using___file__))
 
+    def test_run_setup_stop_after(self):
+        f = self.write_setup(setup_using___file__)
+        for s in ['init', 'config', 'commandline', 'run']:
+            distutils2.core.run_setup(f, stop_after=s)
+        self.assertRaises(ValueError, distutils2.core.run_setup, 
+                          f, stop_after='bob')
+
+    def test_run_setup_args(self):
+        f = self.write_setup(setup_using___file__)
+        d = distutils2.core.run_setup(f, script_args=["--help"], 
+                                        stop_after="init")
+        self.assertEqual(['--help'], d.script_args)
+
     def test_run_setup_uses_current_dir(self):
         # This tests that the setup script is run with the current directory
         # as its own current directory; this was temporarily broken by a
diff --git a/src/distutils2/tests/test_version.py b/src/distutils2/tests/test_version.py
--- a/src/distutils2/tests/test_version.py
+++ b/src/distutils2/tests/test_version.py
@@ -4,7 +4,7 @@
 import os
 
 from distutils2.version import NormalizedVersion as V
-from distutils2.version import IrrationalVersionError
+from distutils2.version import IrrationalVersionError, HugeMajorVersionNumError
 from distutils2.version import suggest_normalized_version as suggest
 from distutils2.version import VersionPredicate
 
@@ -69,6 +69,9 @@
         >>> V('1.0') < V('1.0.post456.dev623')
         True
 
+        >>> V('1.0.1') <= V('1.0')
+        False
+
         >>> V('1.0.post456.dev623') < V('1.0.post456')  < V('1.0.post1234')
         True
 
@@ -97,6 +100,7 @@
     def test_suggest_normalized_version(self):
 
         self.assertEquals(suggest('1.0'), '1.0')
+        self.assertEquals(suggest('v1.0'), '1.0')
         self.assertEquals(suggest('1.0-alpha1'), '1.0a1')
         self.assertEquals(suggest('1.0c2'), '1.0c2')
         self.assertEquals(suggest('walla walla washington'), None)
@@ -125,6 +129,15 @@
         # they us "p1" "p2" for post releases
         self.assertEquals(suggest('1.4p1'), '1.4.post1')
 
+    def test_error_on_major_version(self):
+        self.assertRaises(HugeMajorVersionNumError, V, '2001.1')
+
+    def test_cannot_compare(self):
+        self.assertRaises(TypeError, V('1.1').__lt__, '1.1.1')
+
+    def test_version_repr(self):
+        self.assertEquals("NormalizedVersion('1.1')", repr(V('1.1')))
+
     def test_predicate(self):
         # VersionPredicate knows how to parse stuff like:
         #
@@ -146,7 +159,6 @@
         assert VersionPredicate('Ho (<3.0,!=2.5)').match('2.6.0')
         assert not VersionPredicate('Ho (<3.0,!=2.6)').match('2.6.0')
 
-
         # XXX need to silent the micro version in this case
         #assert not VersionPredicate('Ho (<3.0,!=2.6)').match('2.6.3')
 

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


More information about the Python-checkins mailing list