def iglob(pattern): # noqa: D406,D407,D411,D413 """Expand the given glob pattern with regard to the current working directory. See buildscripts.resmokelib.utils.globstar.iglob(). Returns: A list of paths as a list(str). """ return globstar.iglob(pattern)
def filter_tests(tests: Set[str], exclude_tests: [str]) -> Set[str]: """ Exclude tests which have been blacklisted. :param tests: Set of tests to filter. :param exclude_tests: Tests to filter out. :return: Set of tests with exclude_tests filtered out. """ if not exclude_tests or not tests: return tests # The exclude_tests can be specified using * and ** to specify directory and file patterns. excluded_globbed = set() for exclude_test_pattern in exclude_tests: excluded_globbed.update(globstar.iglob(exclude_test_pattern)) LOGGER.debug("Excluding test pattern", excluded=excluded_globbed) return tests - excluded_globbed
def parse_tag_file(test_kind): """Parse the tag file and return a dict of tagged tests. The resulting dict will have as a key the filename and the value a list of tags, i.e., {'file1.js': ['tag1', 'tag2'], 'file2.js': ['tag2', 'tag3']}. """ tagged_tests = collections.defaultdict(list) if config.TAG_FILE: tags_conf = _tags.TagsConfig.from_file(config.TAG_FILE) tagged_roots = tags_conf.get_test_patterns(test_kind) for tagged_root in tagged_roots: # Multiple tests could be returned for a set of tags. tests = globstar.iglob(tagged_root) test_tags = tags_conf.get_tags(test_kind, tagged_root) for test in tests: # A test could have a tag in more than one place, due to wildcards in the # selector. tagged_tests[test].extend(test_tags) return tagged_tests
def expand_file_string(glob_pattern): """Expand a string that represents a set of files """ return [os.path.abspath(f) for f in globstar.iglob(glob_pattern)]
def expand_file_string(glob_pattern): # type: (str) -> List[str] """Expand a string that represents a set of files.""" return [os.path.abspath(f) for f in globstar.iglob(glob_pattern)]