示例#1
0
def test_find_git_root(git_repo_find_git_root):
    """ A unit test for gitstatus. """
    expect = os.path.join(os.getcwd(), '.git')
    sub_d = os.path.join(os.getcwd(), 'd_one', 'd_two', 'd_three')
    assert os.path.isdir(sub_d)
    os.chdir(sub_d)
    assert gitstatus.find_git_root() == expect
示例#2
0
def test_git_paths_in_normal_repo(git_repo_initial_commit):
    """ A unit test for gitstatus. """
    head_file, stash_file, merge_file, rebase_dir = gitstatus.git_paths(gitstatus.find_git_root())
    assert head_file == os.path.join(os.getcwd(), '.git', 'HEAD')
    assert stash_file == os.path.join(os.getcwd(), '.git', 'logs', 'refs', 'stash')
    assert merge_file == os.path.join(os.getcwd(), '.git', 'MERGE_HEAD')
    assert rebase_dir == os.path.join(os.getcwd(), '.git', 'rebase-apply')
示例#3
0
def test_find_git_root(git_repo_find_git_root):
    """ A unit test for gitstatus. """
    expect = os.path.join(os.getcwd(), '.git')
    sub_d = os.path.join(os.getcwd(), 'd_one', 'd_two', 'd_three')
    assert os.path.isdir(sub_d)
    os.chdir(sub_d)
    assert gitstatus.find_git_root() == expect
示例#4
0
def test_git_paths_in_normal_repo(git_repo_initial_commit):
    """ A unit test for gitstatus. """
    head_file, stash_file, merge_file, rebase_dir = gitstatus.git_paths(
        gitstatus.find_git_root())
    assert head_file == os.path.join(os.getcwd(), '.git', 'HEAD')
    assert stash_file == os.path.join(os.getcwd(), '.git', 'logs', 'refs',
                                      'stash')
    assert merge_file == os.path.join(os.getcwd(), '.git', 'MERGE_HEAD')
    assert rebase_dir == os.path.join(os.getcwd(), '.git', 'rebase-apply')
示例#5
0
def test_git_paths_in_working_tree(git_repo_with_worktree):
    """ A unit test for gitstatus. """
    repo_root = os.getcwd().replace('_worktree', '')
    tree_root = os.path.join(repo_root, '.git', 'worktrees',
                             os.path.basename(repo_root) + '_worktree')
    head_file, stash_file, merge_file, rebase_dir = gitstatus.git_paths(gitstatus.find_git_root())
    assert head_file == os.path.join(tree_root, 'HEAD')
    assert stash_file == os.path.join(repo_root, '.git', 'logs', 'refs', 'stash')
    assert merge_file == os.path.join(tree_root, 'MERGE_HEAD')
    assert rebase_dir == os.path.join(tree_root, 'rebase-apply')
示例#6
0
def test_git_paths_in_working_tree(git_repo_with_worktree):
    """ A unit test for gitstatus. """
    repo_root = os.getcwd().replace('_worktree', '')
    tree_root = os.path.join(repo_root, '.git', 'worktrees',
                             os.path.basename(repo_root) + '_worktree')
    head_file, stash_file, merge_file, rebase_dir = gitstatus.git_paths(
        gitstatus.find_git_root())
    assert head_file == os.path.join(tree_root, 'HEAD')
    assert stash_file == os.path.join(repo_root, '.git', 'logs', 'refs',
                                      'stash')
    assert merge_file == os.path.join(tree_root, 'MERGE_HEAD')
    assert rebase_dir == os.path.join(tree_root, 'rebase-apply')
示例#7
0
def test_find_git_root_fail(empty_working_directory):
    """ A unit test for gitstatus. """
    with pytest.raises(IOError):
        gitstatus.find_git_root()
示例#8
0
def test_find_git_root_fail(empty_working_directory):
    """ A unit test for gitstatus. """
    with pytest.raises(IOError):
        gitstatus.find_git_root()