+++ /dev/null
-"""Tests for distutils.command.clean."""\r
-import sys\r
-import os\r
-import unittest\r
-import getpass\r
-\r
-from distutils.command.clean import clean\r
-from distutils.tests import support\r
-from test.test_support import run_unittest\r
-\r
-class cleanTestCase(support.TempdirManager,\r
- support.LoggingSilencer,\r
- unittest.TestCase):\r
-\r
- def test_simple_run(self):\r
- pkg_dir, dist = self.create_dist()\r
- cmd = clean(dist)\r
-\r
- # let's add some elements clean should remove\r
- dirs = [(d, os.path.join(pkg_dir, d))\r
- for d in ('build_temp', 'build_lib', 'bdist_base',\r
- 'build_scripts', 'build_base')]\r
-\r
- for name, path in dirs:\r
- os.mkdir(path)\r
- setattr(cmd, name, path)\r
- if name == 'build_base':\r
- continue\r
- for f in ('one', 'two', 'three'):\r
- self.write_file(os.path.join(path, f))\r
-\r
- # let's run the command\r
- cmd.all = 1\r
- cmd.ensure_finalized()\r
- cmd.run()\r
-\r
- # make sure the files where removed\r
- for name, path in dirs:\r
- self.assertTrue(not os.path.exists(path),\r
- '%s was not removed' % path)\r
-\r
- # let's run the command again (should spit warnings but succeed)\r
- cmd.all = 1\r
- cmd.ensure_finalized()\r
- cmd.run()\r
-\r
-def test_suite():\r
- return unittest.makeSuite(cleanTestCase)\r
-\r
-if __name__ == "__main__":\r
- run_unittest(test_suite())\r