Пример #1
0
    def test_clean_file_removes_file(self):
        self.fs.CreateFile(os.path.join('tmp', 'dirty-dir', 'file1'))
        self.fs.CreateFile(os.path.join('tmp', 'dirty-dir', 'file2'))
        self.fs.CreateDirectory(os.path.join('tmp', 'dirty-dir', 'dir1'))
        self.fs.CreateFile(os.path.join('tmp', 'dirty-dir', 'dir1', 'file3'))
        clean_file(os.path.join('tmp', 'dirty-dir', 'file1'))

        self.assertTrue(os.path.exists(os.path.join('tmp', 'dirty-dir')))
        self.assertEqual(set(os.listdir(os.path.join('tmp', 'dirty-dir'))), set(['file2', 'dir1']))
Пример #2
0
    def test_clean_file_removes_file(self):
        self.fs.CreateFile(os.path.join('tmp', 'dirty-dir', 'file1'))
        self.fs.CreateFile(os.path.join('tmp', 'dirty-dir', 'file2'))
        self.fs.CreateDirectory(os.path.join('tmp', 'dirty-dir', 'dir1'))
        self.fs.CreateFile(os.path.join('tmp', 'dirty-dir', 'dir1', 'file3'))
        clean_file(os.path.join('tmp', 'dirty-dir', 'file1'))

        self.assertTrue(os.path.exists(os.path.join('tmp', 'dirty-dir')))
        self.assertEqual(set(os.listdir(os.path.join('tmp', 'dirty-dir'))),
                         set(['file2', 'dir1']))
Пример #3
0
    def test_clean_file_creates_parents(self):
        clean_file(os.path.join('tmp', 'dirty-dir', 'file'))

        self.assertTrue(os.path.exists(os.path.join('tmp', 'dirty-dir')))
        self.assertFalse(os.listdir(os.path.join('tmp', 'dirty-dir')))
Пример #4
0
    def test_clean_file_creates_parents(self):
        clean_file(os.path.join('tmp', 'dirty-dir', 'file'))

        self.assertTrue(os.path.exists(os.path.join('tmp', 'dirty-dir')))
        self.assertFalse(os.listdir(os.path.join('tmp', 'dirty-dir')))