Пример #1
0
 def test_find_younger(self):
     found_files = find_files(path='tests/',
                              maximum_file_age=datetime.datetime(
                                  2015, 10, 11))
     comp_files = test_files
     comp_files.remove('tests/subdir1/subdir2/test3.txt')
     comp_files.remove('tests/test1.txt')
     self.assertListEqual(sorted(found_files), sorted(comp_files))
Пример #2
0
 def test_find_older_younger_suffix(self):
     found_files = find_files(
         path='tests/',
         file_suffix=".csv",
         minimum_file_age=datetime.datetime(2017, 10, 11),
         maximum_file_age=datetime.datetime(2015, 10, 9))
     comp_files = ['tests/subdir1/subdir2/test4_2018_08_17.csv']
     self.assertListEqual(sorted(found_files), sorted(comp_files))
Пример #3
0
 def test_find_older(self):
     found_files = find_files(path='tests/',
                              minimum_file_age=datetime.datetime(
                                  2015, 10, 11))
     comp_files = ['tests/subdir1/subdir2/test3.txt', 'tests/test1.txt']
     self.assertListEqual(sorted(found_files), sorted(comp_files))
Пример #4
0
 def test_find_all_suffix(self):
     found_files = sorted(find_files('tests/', file_suffix='.csv'))
     comp_files = sorted([x for x in test_files if ".csv" in x])
     self.assertListEqual(found_files, comp_files)
Пример #5
0
 def test_find_subdir(self):
     found_files = sorted(find_files('tests/', recursion_depth=1))
     comp_files = sorted(test_files[0:10])
     self.assertListEqual(found_files, comp_files)
Пример #6
0
 def test_find_root(self):
     found_files = find_files('tests/', recursion_depth=0)
     comp_files = test_files[0:3]
     self.assertListEqual(sorted(found_files), sorted(comp_files))
Пример #7
0
 def test_find_all(self):
     found_files = find_files('tests/')
     self.assertListEqual(sorted(found_files), sorted(test_files))
Пример #8
0
 def test_delete_files_and_directory(self):
     found_files = find_files(path='tests/subdir1/subdir2/')
     delete_files(found_files, True)
     with self.assertRaises(OSError):
         find_files(path='tests/subdir1/subdir2/')
Пример #9
0
 def test_delete_files(self):
     found_files = find_files(path='tests/subdir1/subdir2/')
     delete_files(found_files)
     found_files = find_files(path='tests/subdir1/subdir2/')
     self.assertListEqual(found_files, [])