]> git.proxmox.com Git - mirror_edk2.git/blame - AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/tests/test_clean.py
EmbeddedPkg: Extend NvVarStoreFormattedLib LIBRARY_CLASS
[mirror_edk2.git] / AppPkg / Applications / Python / Python-2.7.2 / Lib / distutils / tests / test_clean.py
CommitLineData
4710c53d 1"""Tests for distutils.command.clean."""\r
2import sys\r
3import os\r
4import unittest\r
5import getpass\r
6\r
7from distutils.command.clean import clean\r
8from distutils.tests import support\r
9from test.test_support import run_unittest\r
10\r
11class cleanTestCase(support.TempdirManager,\r
12 support.LoggingSilencer,\r
13 unittest.TestCase):\r
14\r
15 def test_simple_run(self):\r
16 pkg_dir, dist = self.create_dist()\r
17 cmd = clean(dist)\r
18\r
19 # let's add some elements clean should remove\r
20 dirs = [(d, os.path.join(pkg_dir, d))\r
21 for d in ('build_temp', 'build_lib', 'bdist_base',\r
22 'build_scripts', 'build_base')]\r
23\r
24 for name, path in dirs:\r
25 os.mkdir(path)\r
26 setattr(cmd, name, path)\r
27 if name == 'build_base':\r
28 continue\r
29 for f in ('one', 'two', 'three'):\r
30 self.write_file(os.path.join(path, f))\r
31\r
32 # let's run the command\r
33 cmd.all = 1\r
34 cmd.ensure_finalized()\r
35 cmd.run()\r
36\r
37 # make sure the files where removed\r
38 for name, path in dirs:\r
39 self.assertTrue(not os.path.exists(path),\r
40 '%s was not removed' % path)\r
41\r
42 # let's run the command again (should spit warnings but succeed)\r
43 cmd.all = 1\r
44 cmd.ensure_finalized()\r
45 cmd.run()\r
46\r
47def test_suite():\r
48 return unittest.makeSuite(cleanTestCase)\r
49\r
50if __name__ == "__main__":\r
51 run_unittest(test_suite())\r