def __init__(self, load_path, recurse=False, ignore_conflicts=False): # Expand any environment variables and symlinks load_path = [os.path.realpath(osext.expandvars(p)) for p in load_path] self._load_path = osext.unique_abs_paths(load_path, recurse) self._recurse = recurse self._ignore_conflicts = ignore_conflicts # Loaded tests by name; maps test names to the file that were defined self._loaded = {}
def test_unique_abs_paths(): p1 = 'a/b/c' p2 = p1[:] p3 = 'a/b' p4 = '/d/e//' p5 = '/d/e/f' expected_paths = [os.path.abspath('a/b'), '/d/e'] actual_paths = osext.unique_abs_paths( [p1, p2, p3, p4, p5]) assert expected_paths == actual_paths expected_paths = [os.path.abspath('a/b/c'), os.path.abspath('a/b'), '/d/e', '/d/e/f'] actual_paths = osext.unique_abs_paths( [p1, p2, p3, p4, p5], prune_children=False) assert expected_paths == actual_paths with pytest.raises(TypeError): osext.unique_abs_paths(None)
def __init__(self, load_path, recurse=False, external_vars=None): # Expand any environment variables and symlinks load_path = [os.path.realpath(osext.expandvars(p)) for p in load_path] self._load_path = osext.unique_abs_paths(load_path, recurse) self._recurse = recurse # Loaded tests by name; maps test names to the file that were defined self._loaded = {} # Variables set in the command line self._external_vars = external_vars or {}