Changeset 5739 for main/waeup.sirp/trunk/src/waeup/sirp/utils/tests
- Timestamp:
- 12 Feb 2011, 15:33:43 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/utils/tests/test_helpers.py
r5737 r5739 33 33 class FakeObject(object): 34 34 implements(IFakeObject) 35 36 class RemoveFileOrDirectoryTestCase(unittest.TestCase): 37 38 def setUp(self): 39 self.dirpath = tempfile.mkdtemp() 40 self.filepath = os.path.join(self.dirpath, 'somefile') 41 self.non_file = os.path.join(self.dirpath, 'nonfile') 42 open(self.filepath, 'wb').write('Hi!') 43 return 44 45 def tearDown(self): 46 if os.path.exists(self.dirpath): 47 shutil.rmtree(self.dirpath) 48 return 49 50 def test_handle_not_existing_path(self): 51 result = helpers.removeFileOrDirectory(self.non_file) 52 self.assertTrue(result is None) 53 return 54 55 def test_handle_dir(self): 56 helpers.removeFileOrDirectory(self.dirpath) 57 self.assertFalse( 58 os.path.exists(self.dirpath) 59 ) 60 return 61 62 def test_handle_file(self): 63 helpers.removeFileOrDirectory(self.filepath) 64 self.assertFalse( 65 os.path.exists(self.filepath) 66 ) 67 return 35 68 36 69 class CopyFileSystemTreeTestCase(unittest.TestCase): … … 117 150 FactoryBaseTestCase, 118 151 CopyFileSystemTreeTestCase, 152 RemoveFileOrDirectoryTestCase, 119 153 ]: 120 154 suite.addTests(
Note: See TracChangeset for help on using the changeset viewer.