예제 #1
0
def test_lstat(testrepo, get_path, path, mode, size, exception, expected_hex):
    path = get_path('HEAD', path)
    if exception:
        expected_hex = None
    else:
        if expected_hex:
            expected_hex = binascii.unhexlify(expected_hex)
        else:
            expected_hex = testrepo[hex_oid(path)].id.raw
    check_stat(path.lstat, mode, expected_hex, size, exception)
예제 #2
0
def test_joinpath_absolute_path(testrepo, get_path):
    path = get_path('HEAD', 'dir').joinpath(Path('/dir/file'))
    assert hex_oid(path) == testrepo.revparse_single('HEAD:dir/file').hex
예제 #3
0
def test_joinpath_multiple(testrepo, get_path):
    path = get_path().joinpath('dir', 'file')
    assert hex_oid(path) == testrepo.revparse_single('HEAD:dir/file').hex
예제 #4
0
def test_joinpath_pathlib(testrepo, get_path):
    path = get_path().joinpath(Path('dir/file'))
    assert hex_oid(path) == testrepo.revparse_single('HEAD:dir/file').hex
예제 #5
0
def test_slash_absolute_str(testrepo, get_path):
    path = get_path('HEAD', 'dir') / '/dir/file'
    assert hex_oid(path) == testrepo.revparse_single('HEAD:dir/file').hex
예제 #6
0
def test_joinpath(testrepo, get_path):
    path = get_path().joinpath('dir')
    assert hex_oid(path) == testrepo.revparse_single('HEAD:dir').hex
예제 #7
0
def test_slash_combined(testrepo, get_path):
    path = get_path() / 'dir/file'
    assert hex_oid(path) == testrepo.revparse_single('HEAD:dir/file').hex
예제 #8
0
def test_slash_pathlib(testrepo, get_path):
    path = get_path() / Path('dir/file')
    assert hex_oid(path) == testrepo.revparse_single('HEAD:dir/file').hex
예제 #9
0
def test_slash_multiple(testrepo, get_path):
    path = get_path() / 'dir' / 'file'
    assert hex_oid(path) == testrepo.revparse_single('HEAD:dir/file').hex
예제 #10
0
def test_slash(testrepo, get_path):
    path = get_path() / 'dir'
    assert hex_oid(path) == testrepo.revparse_single('HEAD:dir').hex
예제 #11
0
def test_components(testrepo, get_path):
    path = get_path('HEAD', 'dir', 'file')
    assert hex_oid(path) == testrepo.revparse_single('HEAD:dir/file').hex
예제 #12
0
def test_parent(testrepo, get_path):
    path = get_path('HEAD^')
    parent = testrepo.head.peel(pygit2.Commit).parents[0]
    assert hex_oid(path) == parent.peel(pygit2.Tree).hex
예제 #13
0
def test_head(testrepo, get_path):
    path = get_path()
    assert hex_oid(path) == testrepo.head.peel(pygit2.Tree).hex