[Python-checkins] distutils2: added back tests removed in a recent merge

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


tarek.ziade pushed 6475f56d4229 to distutils2:

http://hg.python.org/distutils2/rev/6475f56d4229
changeset:   645:6475f56d4229
user:        Konrad Delong <konryd at gmail.com>
date:        Mon Aug 16 11:52:12 2010 +0200
summary:     added back tests removed in a recent merge
files:       src/distutils2/tests/test_dist.py

diff --git a/src/distutils2/tests/test_dist.py b/src/distutils2/tests/test_dist.py
--- a/src/distutils2/tests/test_dist.py
+++ b/src/distutils2/tests/test_dist.py
@@ -327,6 +327,43 @@
                                   'run',
                                   'post-test_dist'])
 
+    def test_hooks_importable(self):
+        temp_home = self.mkdtemp()
+        config_file = os.path.join(temp_home, "config1.cfg")
+
+        self.write_file(config_file, textwrap.dedent('''
+            [test_dist]
+            pre-hook.test = nonexistent.dotted.name'''))
+
+        sys.argv.extend(["--command-packages",
+                         "distutils2.tests",
+                         "test_dist"])
+
+        d = self.create_distribution([config_file])
+        cmd = d.get_command_obj("test_dist")
+        cmd.ensure_finalized()
+
+        self.assertRaises(DistutilsModuleError, d.run_command, 'test_dist')
+
+    def test_hooks_callable(self):
+        temp_home = self.mkdtemp()
+        config_file = os.path.join(temp_home, "config1.cfg")
+
+        self.write_file(config_file, textwrap.dedent('''
+            [test_dist]
+            pre-hook.test = distutils2.tests.test_dist.__doc__'''))
+
+        sys.argv.extend(["--command-packages",
+                         "distutils2.tests",
+                         "test_dist"])
+
+        d = self.create_distribution([config_file])
+        cmd = d.get_command_obj("test_dist")
+        cmd.ensure_finalized()
+
+        self.assertRaises(DistutilsOptionError, d.run_command, 'test_dist')
+
+
 class MetadataTestCase(support.TempdirManager, support.EnvironGuard,
                        support.LoggingCatcher, unittest.TestCase):
 

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


More information about the Python-checkins mailing list