Skip to content

Commit eff9734

Browse files
committed
test_nonunicode xfails in in macOS/Windows
1 parent 43bbe11 commit eff9734

7 files changed

+28
-25
lines changed

test/test_commit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
)
4141

4242

43-
@utils.refcount
43+
@utils.requires_refcount
4444
def test_commit_refcount(barerepo):
4545
commit = barerepo[COMMIT_SHA]
4646
start = sys.getrefcount(commit)

test/test_credentials.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
# the Free Software Foundation, 51 Franklin Street, Fifth Floor,
2424
# Boston, MA 02110-1301, USA.
2525

26-
"""Tests for credentials"""
27-
2826
from pathlib import Path
2927
import platform
3028

test/test_nonunicode.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,17 @@
2525

2626
"""Tests for non unicode byte strings"""
2727

28-
import pygit2
2928
import os
3029
import shutil
3130

31+
import pygit2
32+
from . import utils
33+
3234

3335
bstring = b'\xc3master'
3436

35-
37+
@utils.requires_network
38+
@utils.requires_linux
3639
def test_nonunicode_branchname(testrepo):
3740
folderpath = 'temp_repo_nonutf'
3841
if os.path.exists(folderpath):

test/test_remote.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,12 @@
2323
# the Free Software Foundation, 51 Franklin Street, Fifth Floor,
2424
# Boston, MA 02110-1301, USA.
2525

26-
"""Tests for Remote objects."""
27-
2826
from unittest.mock import patch
2927
import sys
3028

3129
import pytest
3230

3331
import pygit2
34-
from pygit2 import Oid
35-
from pygit2.ffi import ffi
3632
from . import utils
3733

3834

@@ -220,7 +216,7 @@ def test_remote_collection(testrepo):
220216
assert remote.name in [x.name for x in testrepo.remotes]
221217

222218

223-
@utils.refcount
219+
@utils.requires_refcount
224220
def test_remote_refcount(testrepo):
225221
start = sys.getrefcount(testrepo)
226222
remote = testrepo.remotes[0]
@@ -272,13 +268,13 @@ def test_update_tips(emptyrepo):
272268
tips = [
273269
(
274270
'refs/remotes/origin/master',
275-
Oid(hex='0' * 40),
276-
Oid(hex='784855caf26449a1914d2cf62d12b9374d76ae78'),
271+
pygit2.Oid(hex='0' * 40),
272+
pygit2.Oid(hex='784855caf26449a1914d2cf62d12b9374d76ae78'),
277273
),
278274
(
279275
'refs/tags/root',
280-
Oid(hex='0' * 40),
281-
Oid(hex='3d2962987c695a29f1f80b6c3aa4ec046ef44369'),
276+
pygit2.Oid(hex='0' * 40),
277+
pygit2.Oid(hex='3d2962987c695a29f1f80b6c3aa4ec046ef44369'),
282278
),
283279
]
284280

test/test_repository.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ def test_discover_repo(tmp_path):
629629
assert repo.path == discover_repository(str(subdir))
630630

631631

632-
@utils.fspath
632+
@utils.requires_fspath
633633
def test_discover_repo_aspath(tmp_path):
634634
repo = init_repository(Path(tmp_path), False)
635635
subdir = Path(tmp_path) / 'test1' / 'test2'
@@ -811,7 +811,7 @@ def _check_worktree(worktree):
811811
assert testrepo.list_worktrees() == []
812812

813813

814-
@utils.fspath
814+
@utils.requires_fspath
815815
def test_worktree_aspath(testrepo):
816816
worktree_name = 'foo'
817817
worktree_dir = Path(tempfile.mkdtemp())

test/test_repository_bare.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@
2323
# the Free Software Foundation, 51 Franklin Street, Fifth Floor,
2424
# Boston, MA 02110-1301, USA.
2525

26-
# Standard Library
2726
import binascii
2827
import os
29-
from pathlib import Path
28+
import pathlib
3029
import sys
3130
import tempfile
31+
3232
import pytest
3333

3434
import pygit2
@@ -160,7 +160,7 @@ def test_expand_id(barerepo):
160160
assert commit_sha == expanded
161161

162162

163-
@utils.refcount
163+
@utils.requires_refcount
164164
def test_lookup_commit_refcount(barerepo):
165165
start = sys.getrefcount(barerepo)
166166
commit_sha = '5fe808e8953c12735680c257f56600cb0de44b10'
@@ -173,7 +173,7 @@ def test_lookup_commit_refcount(barerepo):
173173
def test_get_path(barerepo_path):
174174
barerepo, path = barerepo_path
175175

176-
directory = Path(barerepo.path).resolve()
176+
directory = pathlib.Path(barerepo.path).resolve()
177177
assert directory == path.resolve()
178178

179179

@@ -199,7 +199,7 @@ def test_hashfile(barerepo):
199199
with os.fdopen(handle, 'w') as fh:
200200
fh.write(data)
201201
hashed_sha1 = pygit2.hashfile(tempfile_path)
202-
Path(tempfile_path).unlink()
202+
pathlib.Path(tempfile_path).unlink()
203203
written_sha1 = barerepo.create_blob(data)
204204
assert hashed_sha1 == written_sha1
205205

test/utils.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
import pygit2
4040

4141

42-
requires_future_libgit2 = pytest.mark.skipif(
42+
requires_future_libgit2 = pytest.mark.xfail(
4343
pygit2.LIBGIT2_VER < (2, 0, 0),
4444
reason='This test may work with a future version of libgit2',
4545
)
@@ -58,18 +58,24 @@
5858
requires_proxy = pytest.mark.skipif(not has_proxy, reason='Requires proxy at port 8888')
5959

6060
requires_ssh = pytest.mark.skipif(
61-
pygit2.enums.Feature.SSH not in pygit2.features, reason='Requires SSH'
61+
pygit2.enums.Feature.SSH not in pygit2.features,
62+
reason='Requires SSH'
6263
)
6364

6465

6566
is_pypy = '__pypy__' in sys.builtin_module_names
6667

67-
fspath = pytest.mark.skipif(
68+
requires_fspath = pytest.mark.xfail(
6869
is_pypy,
6970
reason="PyPy doesn't fully support fspath, see https://foss.heptapod.net/pypy/pypy/-/issues/3168",
7071
)
7172

72-
refcount = pytest.mark.skipif(is_pypy, reason='skip refcounts checks in pypy')
73+
requires_refcount = pytest.mark.skipif(is_pypy, reason='skip refcounts checks in pypy')
74+
75+
requires_linux = pytest.mark.xfail(
76+
sys.platform != 'linux',
77+
reason='probably a bug in libgit2 for non-linux platforms'
78+
)
7379

7480

7581
def gen_blob_sha1(data):

0 commit comments

Comments
 (0)