Issue #7575: An overflow test for math.expm1 was failing on OS X 10.4/Intel,
[python.git] / Lib / distutils / tests / test_clean.py
blobdbc4ee2a186f74d55d7e98e21ed98e8d494b6264
1 """Tests for distutils.command.clean."""
2 import sys
3 import os
4 import unittest
5 import getpass
7 from distutils.command.clean import clean
8 from distutils.tests import support
10 class cleanTestCase(support.TempdirManager,
11 support.LoggingSilencer,
12 unittest.TestCase):
14 def test_simple_run(self):
15 pkg_dir, dist = self.create_dist()
16 cmd = clean(dist)
18 # let's add some elements clean should remove
19 dirs = [(d, os.path.join(pkg_dir, d))
20 for d in ('build_temp', 'build_lib', 'bdist_base',
21 'build_scripts', 'build_base')]
23 for name, path in dirs:
24 os.mkdir(path)
25 setattr(cmd, name, path)
26 if name == 'build_base':
27 continue
28 for f in ('one', 'two', 'three'):
29 self.write_file(os.path.join(path, f))
31 # let's run the command
32 cmd.all = 1
33 cmd.ensure_finalized()
34 cmd.run()
36 # make sure the files where removed
37 for name, path in dirs:
38 self.assertTrue(not os.path.exists(path),
39 '%s was not removed' % path)
41 # let's run the command again (should spit warnings but suceed)
42 cmd.all = 1
43 cmd.ensure_finalized()
44 cmd.run()
46 def test_suite():
47 return unittest.makeSuite(cleanTestCase)
49 if __name__ == "__main__":
50 unittest.main(defaultTest="test_suite")