Issues (17)

tests/test_git_repo.py (2 issues)

Severity
1
"""
2
Test related to Git repo in the generated project.
3
"""
4
import git
0 ignored issues
show
Unable to import 'git'
Loading history...
5
import pytest
0 ignored issues
show
Unable to import 'pytest'
Loading history...
6
7
from . import bake_cookie
8
9
10
def test_git_repo_is_clean(cookies):
11
    "Check that Git repo does not have any files not committed"
12
    with bake_cookie(cookies) as result:
13
        assert result.project_path.is_dir()
14
        repo = git.Repo(result.project_path)
15
        assert not repo.bare
16
        assert not repo.is_dirty(untracked_files=True)
17
18
19
def test_no_git_repo(cookies):
20
    "Check that Git repo is not created when the option is False"
21
    with bake_cookie(cookies, extra_context={"initialize_git_repo": "no"}) as result:
22
        print(dir(result.project_path))
23
        assert result.project_path.is_dir()
24
        with pytest.raises(git.exc.InvalidGitRepositoryError):
25
            git.Repo(result.project_path)
26