-
-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests(git): add test to cover not a git repository case (#311)
This commit adds a test to cover the folder is not a git repository corner case.
- Loading branch information
Showing
1 changed file
with
17 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
from unittest import mock | ||
|
||
import coveralls.git | ||
|
||
from coveralls.exception import CoverallsException | ||
|
||
GIT_COMMIT_MSG = 'first commit' | ||
GIT_EMAIL = '[email protected]' | ||
|
@@ -108,6 +108,22 @@ def test_gitlog_envvars(self): | |
} | ||
|
||
|
||
class GitInfoTestNotAGitRepository(unittest.TestCase): | ||
def setUp(self): | ||
self.dir = tempfile.mkdtemp() | ||
|
||
os.chdir(self.dir) | ||
|
||
def tearDown(self): | ||
shutil.rmtree(self.dir) | ||
|
||
def test_gitlog_not_a_git_repo(self): | ||
git_info = coveralls.git.git_info() | ||
|
||
self.assertRaises(CoverallsException) | ||
assert git_info == {} | ||
|
||
|
||
class GitInfoTestBranch(GitTest): | ||
@mock.patch.dict(os.environ, { | ||
'GITHUB_ACTIONS': 'true', | ||
|