def test_file_to_compare_filter(self): """If the `relevant_paths` param is provided, only files which match it should be returned""" self.populate([("dir1", "sub1", "a"), ("dir1", "sub2", "b"), ("dir2", "c"), ("dir3", "d"), ("dir22", "e")]) results = compare_to.files_to_compare(self.tmpdir, [os.path.join("dir1", "sub1"), "dir2"]) self.assertItemsEqual( results, [os.path.join("dir1", "sub1", "a"), os.path.join("dir2", "c"), os.path.join("dir22", "e")] )
def test_files_to_compare_lists(self): """Files to compare should find all of the files present in the temp directory""" file_names = self.populate( [("dir1", "sub1", "a"), ("dir1", "sub1", "b"), ("dir1", "sub2", "c"), ("dir2", "d"), ("dir2", "e"), ("f",)] ) os.mkdir(os.path.join(self.tmpdir, "empty-dir")) self.assertItemsEqual( compare_to.files_to_compare(self.tmpdir), # note that file_names do not include the tmpdir file_names, )