Пример #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