2727
2828# Import from the Standard Library
2929import binascii
30- import unittest
3130import shutil
3231import tempfile
3332import os
4746import pygit2
4847from . import utils
4948
50- try :
51- import __pypy__
52- except ImportError :
53- __pypy__ = None
54-
5549
5650HEAD_SHA = '784855caf26449a1914d2cf62d12b9374d76ae78'
5751PARENT_SHA = 'f5e5aa4e36ab0fe62ee1ccc6eb8f79b866863b87' # HEAD^
@@ -159,7 +153,7 @@ def test_expand_id(self):
159153 expanded = self .repo .expand_id (commit_sha [:7 ])
160154 assert commit_sha == expanded .hex
161155
162- @unittest . skipIf ( __pypy__ is not None , "skip refcounts checks in pypy" )
156+ @utils . refcount
163157 def test_lookup_commit_refcount (self ):
164158 start = sys .getrefcount (self .repo )
165159 commit_sha = '5fe808e8953c12735680c257f56600cb0de44b10'
@@ -516,7 +510,7 @@ def test_no_arg(tmp_path):
516510 repo = init_repository (tmp_path )
517511 assert not repo .is_bare
518512
519- @unittest . skipIf ( not utils .has_fspath , "Requires PEP-519 (FSPath) support" )
513+ @utils .fspath
520514def test_no_arg_aspath (tmp_path ):
521515 repo = init_repository (Path (tmp_path ))
522516 assert not repo .is_bare
@@ -544,7 +538,7 @@ def test_discover_repo(tmp_path):
544538 os .makedirs (subdir )
545539 assert repo .path == discover_repository (subdir )
546540
547- @unittest . skipIf ( not utils .has_fspath , "Requires PEP-519 (FSPath) support" )
541+ @utils .fspath
548542def test_discover_repo_aspath (tmp_path ):
549543 repo = init_repository (Path (tmp_path ), False )
550544 subdir = Path (tmp_path ) / "test1" / "test2"
@@ -577,7 +571,7 @@ def test_unicode_string():
577571 repo_path = './test/data/testrepo.git/'
578572 pygit2 .Repository (repo_path )
579573
580- @unittest . skipIf ( not utils .has_fspath , "Requires PEP-519 (FSPath) support" )
574+ @utils .fspath
581575def test_aspath ():
582576 repo_path = Path ('./test/data/testrepo.git/' )
583577 pygit2 .Repository (repo_path )
@@ -589,7 +583,7 @@ def test_clone_repository(tmp_path):
589583 assert not repo .is_empty
590584 assert not repo .is_bare
591585
592- @unittest . skipIf ( not utils .has_fspath , "Requires PEP-519 (FSPath) support" )
586+ @utils .fspath
593587def test_clone_repository_aspath (tmp_path ):
594588 repo_path = Path ("./test/data/testrepo.git/" )
595589 repo = clone_repository (repo_path , Path (tmp_path ))
@@ -624,7 +618,8 @@ def create_remote(repo, name, url):
624618 assert 'refs/remotes/custom_remote/master' in repo .listall_references ()
625619 assert repo .remotes ["custom_remote" ] is not None
626620
627- @unittest .skipIf (utils .no_network (), "Requires network" )
621+
622+ @utils .network
628623def test_clone_with_credentials (tmp_path ):
629624 url = 'https://github.com/libgit2/TestGitRepository'
630625 credentials = pygit2 .UserPass ("libgit2" , "libgit2" )
@@ -633,7 +628,7 @@ def test_clone_with_credentials(tmp_path):
633628
634629 assert not repo .is_empty
635630
636- @unittest . skipIf ( utils .no_network (), "Requires network" )
631+ @utils .network
637632def test_clone_bad_credentials (tmp_path ):
638633 class MyCallbacks (pygit2 .RemoteCallbacks ):
639634 def credentials (self , url , username , allowed ):
@@ -738,7 +733,7 @@ def _check_worktree(worktree):
738733 worktree .prune (True )
739734 assert self .repo .list_worktrees () == []
740735
741- @unittest . skipIf ( not utils .has_fspath , "Requires PEP-519 (FSPath) support" )
736+ @utils .fspath
742737 def test_worktree_aspath (self ):
743738 worktree_name = 'foo'
744739 worktree_dir = Path (tempfile .mkdtemp ())
0 commit comments