summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/tests/test_install_scripts.py
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2004-06-15 15:49:46 (GMT)
committerFred Drake <fdrake@acm.org>2004-06-15 15:49:46 (GMT)
commitbb7c14461d8c69a9ffd70ae012b28ad35a9f3e78 (patch)
treea6e53692c746123bae1830b8dc95df60036be7cc /Lib/distutils/tests/test_install_scripts.py
parenta050171ee9e44697260cd5415310777dadb5555e (diff)
downloadcpython-bb7c14461d8c69a9ffd70ae012b28ad35a9f3e78.zip
cpython-bb7c14461d8c69a9ffd70ae012b28ad35a9f3e78.tar.gz
cpython-bb7c14461d8c69a9ffd70ae012b28ad35a9f3e78.tar.bz2
One unit test for distutils is not much, but is more than we had yesterday.
We need to write more; hopefully the barrier is a little lower now.
Diffstat (limited to 'Lib/distutils/tests/test_install_scripts.py')
-rw-r--r--Lib/distutils/tests/test_install_scripts.py46
1 files changed, 46 insertions, 0 deletions
diff --git a/Lib/distutils/tests/test_install_scripts.py b/Lib/distutils/tests/test_install_scripts.py
new file mode 100644
index 0000000..f9a95ea
--- /dev/null
+++ b/Lib/distutils/tests/test_install_scripts.py
@@ -0,0 +1,46 @@
+"""Tests for distutils.command.install_scripts."""
+
+import os
+import unittest
+
+from distutils.command.install_scripts import install_scripts
+from distutils.core import Distribution
+
+
+class InstallScriptsTestCase(unittest.TestCase):
+
+ def test_default_settings(self):
+ dist = Distribution()
+ dist.command_obj["build"] = DummyCommand(build_scripts="/foo/bar")
+ dist.command_obj["install"] = DummyCommand(
+ install_scripts="/splat/funk",
+ force=1,
+ skip_build=1,
+ )
+ cmd = install_scripts(dist)
+ self.assert_(not cmd.force)
+ self.assert_(not cmd.skip_build)
+ self.assert_(cmd.build_dir is None)
+ self.assert_(cmd.install_dir is None)
+
+ cmd.finalize_options()
+
+ self.assert_(cmd.force)
+ self.assert_(cmd.skip_build)
+ self.assertEqual(cmd.build_dir, "/foo/bar")
+ self.assertEqual(cmd.install_dir, "/splat/funk")
+
+
+class DummyCommand:
+
+ def __init__(self, **kwargs):
+ for kw, val in kwargs.items():
+ setattr(self, kw, val)
+
+ def ensure_finalized(self):
+ pass
+
+
+
+def test_suite():
+ return unittest.makeSuite(InstallScriptsTestCase)