##// END OF EJS Templates
git: use bool condition to check if the git path is fine. Using exceptions...
marcink -
r2452:c74b82e7 default
parent child Browse files
Show More
@@ -163,7 +163,11 b' class GitRepository(BaseRepository):'
163 else:
163 else:
164 self._remote.init()
164 self._remote.init()
165 else:
165 else:
166 self._remote.assert_correct_path()
166 if not self._remote.assert_correct_path():
167 raise RepositoryError(
168 'Path "%s" does not contain a Git repository' %
169 (self.path,))
170
167 # TODO: johbo: check if we have to translate the OSError here
171 # TODO: johbo: check if we have to translate the OSError here
168 except OSError as err:
172 except OSError as err:
169 raise RepositoryError(err)
173 raise RepositoryError(err)
@@ -85,7 +85,7 b' class TestGitRepository:'
85 return GitRepository(next(REPO_PATH_GENERATOR), create=True, bare=bare)
85 return GitRepository(next(REPO_PATH_GENERATOR), create=True, bare=bare)
86
86
87 def test_wrong_repo_path(self):
87 def test_wrong_repo_path(self):
88 wrong_repo_path = '/tmp/errorrepo'
88 wrong_repo_path = '/tmp/errorrepo_git'
89 with pytest.raises(RepositoryError):
89 with pytest.raises(RepositoryError):
90 GitRepository(wrong_repo_path)
90 GitRepository(wrong_repo_path)
91
91
@@ -79,7 +79,7 b' class TestMercurialRepository:'
79 return MercurialRepository(next(REPO_PATH_GENERATOR), create=True)
79 return MercurialRepository(next(REPO_PATH_GENERATOR), create=True)
80
80
81 def test_wrong_repo_path(self):
81 def test_wrong_repo_path(self):
82 wrong_repo_path = '/tmp/errorrepo'
82 wrong_repo_path = '/tmp/errorrepo_hg'
83 with pytest.raises(RepositoryError):
83 with pytest.raises(RepositoryError):
84 MercurialRepository(wrong_repo_path)
84 MercurialRepository(wrong_repo_path)
85
85
General Comments 0
You need to be logged in to leave comments. Login now