NovaBryan/EVE_Dump
Log | Files | 📦 下载最新源码 (.zip) | Refs | README

test_clean.py (1231B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\carbon\common\stdlib\distutils\tests\test_clean.py
      2 import sys
      3 import os
      4 import unittest
      5 import getpass
      6 from distutils.command.clean import clean
      7 from distutils.tests import support
      8 
      9 class cleanTestCase(support.TempdirManager, support.LoggingSilencer, unittest.TestCase):
     10 
     11     def test_simple_run(self):
     12         pkg_dir, dist = self.create_dist()
     13         cmd = clean(dist)
     14         dirs = [ (d, os.path.join(pkg_dir, d)) for d in ('build_temp', 'build_lib', 'bdist_base', 'build_scripts', 'build_base') ]
     15         for name, path in dirs:
     16             os.mkdir(path)
     17             setattr(cmd, name, path)
     18             if name == 'build_base':
     19                 continue
     20             for f in ('one', 'two', 'three'):
     21                 self.write_file(os.path.join(path, f))
     22 
     23         cmd.all = 1
     24         cmd.ensure_finalized()
     25         cmd.run()
     26         for name, path in dirs:
     27             self.assertTrue(not os.path.exists(path), '%s was not removed' % path)
     28 
     29         cmd.all = 1
     30         cmd.ensure_finalized()
     31         cmd.run()
     32 
     33 
     34 def test_suite():
     35     return unittest.makeSuite(cleanTestCase)
     36 
     37 
     38 if __name__ == '__main__':
     39     unittest.main(defaultTest='test_suite')