Exemple #1
0
def test_is_repo_clean_no_master(git_dir):
    run('git checkout -b new_branch', cwd=str(git_dir))

    with pytest.raises(FatalError) as excinfo:
        git.is_repo_clean(repo_path=str(git_dir))
    assert 'branch should be master' in str(excinfo.value)

    assert git.is_repo_clean(repo_path=str(git_dir), master=False) is None
Exemple #2
0
def test_is_repo_clean(git_dir):
    assert git.is_repo_clean(repo_path=str(git_dir)) is None

    new_file = git_dir / 'new_file.txt'
    with new_file.open('w') as f:
        f.write('Some text')

    run('git add new_file.txt', cwd=str(git_dir))
    with pytest.raises(FatalError) as excinfo:
        git.is_repo_clean(repo_path=str(git_dir))
    assert 'working tree contains modifications' in str(excinfo.value)
Exemple #3
0
def test_is_repo_clean_no_repo(dir_with_file):
    with pytest.raises(FatalError) as excinfo:
        git.is_repo_clean(repo_path=str(dir_with_file))
    assert 'No git repo' in str(excinfo.value)