def test_hg_find_repo(hg_repo_path): path = str(hg_repo_path) assert path == detect_repository.find_repo_root(path)
def test_fail_find_repo(): path = "/non/existing/path" assert detect_repository.find_repo_root(path) is None
def test_git_find_repo(git_repo_path): path = str(git_repo_path) assert path == detect_repository.find_repo_root(path) subdir = git_repo_path / "test_dir" subdir.mkdir() assert path == detect_repository.find_repo_root(str(subdir))