summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/tests/test_clean.py
diff options
context:
space:
mode:
authorTarek Ziadé <ziade.tarek@gmail.com>2009-03-31 21:37:16 (GMT)
committerTarek Ziadé <ziade.tarek@gmail.com>2009-03-31 21:37:16 (GMT)
commitbaf518046c9d5044572abcd74e7da1b097c946f6 (patch)
tree439fb5533941a49c2770ada1f3bf4dc02ba97c79 /Lib/distutils/tests/test_clean.py
parent2ca15013ec4fe77490e3205cd9ed8f9138f786fe (diff)
downloadcpython-baf518046c9d5044572abcd74e7da1b097c946f6.zip
cpython-baf518046c9d5044572abcd74e7da1b097c946f6.tar.gz
cpython-baf518046c9d5044572abcd74e7da1b097c946f6.tar.bz2
Merged revisions 70886,70888-70892 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r70886 | tarek.ziade | 2009-03-31 15:50:59 -0500 (Tue, 31 Mar 2009) | 1 line added tests for the clean command ........ r70888 | tarek.ziade | 2009-03-31 15:53:13 -0500 (Tue, 31 Mar 2009) | 1 line more tests for the register command ........ r70889 | tarek.ziade | 2009-03-31 15:53:55 -0500 (Tue, 31 Mar 2009) | 1 line more tests for the upload command ........ r70890 | tarek.ziade | 2009-03-31 15:54:38 -0500 (Tue, 31 Mar 2009) | 1 line added test to the install_data command ........ r70891 | tarek.ziade | 2009-03-31 15:55:21 -0500 (Tue, 31 Mar 2009) | 1 line added tests to the install_headers command ........ r70892 | tarek.ziade | 2009-03-31 15:56:11 -0500 (Tue, 31 Mar 2009) | 1 line making sdist and config test silents ........
Diffstat (limited to 'Lib/distutils/tests/test_clean.py')
-rwxr-xr-xLib/distutils/tests/test_clean.py49
1 files changed, 49 insertions, 0 deletions
diff --git a/Lib/distutils/tests/test_clean.py b/Lib/distutils/tests/test_clean.py
new file mode 100755
index 0000000..a94a812
--- /dev/null
+++ b/Lib/distutils/tests/test_clean.py
@@ -0,0 +1,49 @@
+"""Tests for distutils.command.clean."""
+import sys
+import os
+import unittest
+import getpass
+
+from distutils.command.clean import clean
+from distutils.tests import support
+
+class cleanTestCase(support.TempdirManager,
+ unittest.TestCase):
+
+ def test_simple_run(self):
+ pkg_dir, dist = self.create_dist()
+ cmd = clean(dist)
+
+ # let's add some elements clean should remove
+ dirs = [(d, os.path.join(pkg_dir, d))
+ for d in ('build_temp', 'build_lib', 'bdist_base',
+ 'build_scripts', 'build_base')]
+
+ for name, path in dirs:
+ os.mkdir(path)
+ setattr(cmd, name, path)
+ if name == 'build_base':
+ continue
+ for f in ('one', 'two', 'three'):
+ self.write_file(os.path.join(path, f))
+
+ # let's run the command
+ cmd.all = 1
+ cmd.ensure_finalized()
+ cmd.run()
+
+ # make sure the files where removed
+ for name, path in dirs:
+ self.assert_(not os.path.exists(path),
+ '%s was not removed' % path)
+
+ # let's run the command again (should spit warnings but suceed)
+ cmd.all = 1
+ cmd.ensure_finalized()
+ cmd.run()
+
+def test_suite():
+ return unittest.makeSuite(cleanTestCase)
+
+if __name__ == "__main__":
+ unittest.main(defaultTest="test_suite")