]>
git.proxmox.com Git - mirror_edk2.git/blob - AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/tests/test_clean.py
1 """Tests for distutils.command.clean."""
7 from distutils
.command
.clean
import clean
8 from distutils
.tests
import support
9 from test
.test_support
import run_unittest
11 class cleanTestCase(support
.TempdirManager
,
12 support
.LoggingSilencer
,
15 def test_simple_run(self
):
16 pkg_dir
, dist
= self
.create_dist()
19 # let's add some elements clean should remove
20 dirs
= [(d
, os
.path
.join(pkg_dir
, d
))
21 for d
in ('build_temp', 'build_lib', 'bdist_base',
22 'build_scripts', 'build_base')]
24 for name
, path
in dirs
:
26 setattr(cmd
, name
, path
)
27 if name
== 'build_base':
29 for f
in ('one', 'two', 'three'):
30 self
.write_file(os
.path
.join(path
, f
))
32 # let's run the command
34 cmd
.ensure_finalized()
37 # make sure the files where removed
38 for name
, path
in dirs
:
39 self
.assertTrue(not os
.path
.exists(path
),
40 '%s was not removed' % path
)
42 # let's run the command again (should spit warnings but succeed)
44 cmd
.ensure_finalized()
48 return unittest
.makeSuite(cleanTestCase
)
50 if __name__
== "__main__":
51 run_unittest(test_suite())