def test_get_all_files_no_exclusion(self): files = repex.get_all_files( filename_regex=TEST_FILE_NAME, path=TEST_RESOURCES_DIR_PATTERN, base_dir=TEST_RESOURCES_DIR) for version_file in self.version_files: self.assertIn(version_file, files)
def test_get_all_regex_files(self): mock_yaml_files = [f for f in os.listdir(TEST_RESOURCES_DIR) if (f.startswith('mock') and f.endswith('yaml'))] files = repex.get_all_files( filename_regex='mock.*\.yaml', path=TEST_RESOURCES_DIR_PATTERN, base_dir=TEST_RESOURCES_DIR) self.assertEquals(len(mock_yaml_files), len(files)) for f in mock_yaml_files: self.assertIn(os.path.join(TEST_RESOURCES_DIR, f), files)
def test_get_all_files_with_dir_exclusion(self): files = repex.get_all_files( filename_regex=TEST_FILE_NAME, path=TEST_RESOURCES_DIR_PATTERN, base_dir=TEST_RESOURCES_DIR, excluded_paths=self.multi_file_excluded_dirs) for version_file in self.version_files_without_excluded: self.assertIn(version_file, files) for f in self.excluded_files: self.assertNotIn(os.path.join(self.base_dir, f), files)
def test_get_all_regex_files_with_exclusion(self): mock_yaml_files = [os.path.join('single', 'mock_VERSION')] files = repex.get_all_files( filename_regex='mock.*', path=TEST_RESOURCES_DIR_PATTERN, base_dir=TEST_RESOURCES_DIR, excluded_paths=['multiple'], verbose=True, excluded_filename_regex='.*yaml',) self.assertEquals(len(mock_yaml_files), len(files)) for f in mock_yaml_files: self.assertIn(os.path.join(TEST_RESOURCES_DIR, f), files)