def test_ProcessIgnore_process_codebase_does_not_fail_to_access_an_ignored_resourced_cached_to_disk( self): test_dir = self.extract_test_tar('plugin_ignore/user.tgz') codebase = Codebase(test_dir, max_in_memory=1) test_plugin = ProcessIgnore() ignore = ['test'] test_plugin.process_codebase(codebase, ignore=ignore)
def test_resource_paths_with_multiple_plugins(self): test_dir = self.extract_test_tar('ignore/user.tgz') scan_cache_class = get_scans_cache_class(self.get_temp_dir()) test_plugins = [ ProcessIgnore(('*.doc', )), ProcessIgnore(('*/src/test/*', )) ] expected = ['user', 'user/src', 'user/src/test'] test = [ resource.rel_path for resource in resource_paths( test_dir, False, scan_cache_class, test_plugins) ] assert expected == sorted(test)
def test_resource_paths_with_glob_file(self): test_dir = self.extract_test_tar('ignore/user.tgz') test_plugin = ProcessIgnore(('*.doc', )) scan_cache_class = get_scans_cache_class(self.get_temp_dir()) expected = [ 'user', 'user/src', 'user/src/test', 'user/src/test/sample.txt' ] test = [ resource.rel_path for resource in resource_paths( test_dir, False, scan_cache_class, [test_plugin]) ] assert expected == sorted(test)
def check_ProcessIgnore(self, test_dir, expected, ignore): codebase = Codebase(test_dir, strip_root=True) test_plugin = ProcessIgnore() test_plugin.process_codebase(codebase, ignore=ignore) resources = [res.path for res in codebase.walk(skip_root=True)] assert expected == sorted(resources)