11import platform
22from pathlib import Path
3+ from typing import Generator
34
45import pytest
56
67import pygit2
8+ from pygit2 import Repository
79
810from . import utils
911
1012
1113@pytest .fixture (scope = 'session' , autouse = True )
12- def global_git_config ():
14+ def global_git_config () -> None :
1315 # Do not use global config for better test reproducibility.
1416 # https://github.com/libgit2/pygit2/issues/989
1517 levels = [
@@ -26,74 +28,76 @@ def global_git_config():
2628
2729
2830@pytest .fixture
29- def pygit2_empty_key ():
31+ def pygit2_empty_key () -> tuple [ Path , str , str ] :
3032 path = Path (__file__ ).parent / 'keys' / 'pygit2_empty'
3133 return path , f'{ path } .pub' , 'empty'
3234
3335
3436@pytest .fixture
35- def barerepo (tmp_path ) :
37+ def barerepo (tmp_path : Path ) -> Generator [ Repository , None , None ] :
3638 with utils .TemporaryRepository ('barerepo.zip' , tmp_path ) as path :
3739 yield pygit2 .Repository (path )
3840
3941
4042@pytest .fixture
41- def barerepo_path (tmp_path ) :
43+ def barerepo_path (tmp_path : Path ) -> Generator [ tuple [ Repository , Path ], None , None ] :
4244 with utils .TemporaryRepository ('barerepo.zip' , tmp_path ) as path :
4345 yield pygit2 .Repository (path ), path
4446
4547
4648@pytest .fixture
47- def blameflagsrepo (tmp_path ) :
49+ def blameflagsrepo (tmp_path : Path ) -> Generator [ Repository , None , None ] :
4850 with utils .TemporaryRepository ('blameflagsrepo.zip' , tmp_path ) as path :
4951 yield pygit2 .Repository (path )
5052
5153
5254@pytest .fixture
53- def dirtyrepo (tmp_path ) :
55+ def dirtyrepo (tmp_path : Path ) -> Generator [ Repository , None , None ] :
5456 with utils .TemporaryRepository ('dirtyrepo.zip' , tmp_path ) as path :
5557 yield pygit2 .Repository (path )
5658
5759
5860@pytest .fixture
59- def emptyrepo (barerepo , tmp_path ):
61+ def emptyrepo (
62+ barerepo : Repository , tmp_path : Path
63+ ) -> Generator [Repository , None , None ]:
6064 with utils .TemporaryRepository ('emptyrepo.zip' , tmp_path ) as path :
6165 repo = pygit2 .Repository (path )
6266 repo .remotes .create ('origin' , barerepo .path )
6367 yield repo
6468
6569
6670@pytest .fixture
67- def encodingrepo (tmp_path ) :
71+ def encodingrepo (tmp_path : Path ) -> Generator [ Repository , None , None ] :
6872 with utils .TemporaryRepository ('encoding.zip' , tmp_path ) as path :
6973 yield pygit2 .Repository (path )
7074
7175
7276@pytest .fixture
73- def mergerepo (tmp_path ) :
77+ def mergerepo (tmp_path : Path ) -> Generator [ Repository , None , None ] :
7478 with utils .TemporaryRepository ('testrepoformerging.zip' , tmp_path ) as path :
7579 yield pygit2 .Repository (path )
7680
7781
7882@pytest .fixture
79- def testrepo (tmp_path ) :
83+ def testrepo (tmp_path : Path ) -> Generator [ Repository , None , None ] :
8084 with utils .TemporaryRepository ('testrepo.zip' , tmp_path ) as path :
8185 yield pygit2 .Repository (path )
8286
8387
8488@pytest .fixture
85- def testrepo_path (tmp_path ) :
89+ def testrepo_path (tmp_path : Path ) -> Generator [ tuple [ Repository , Path ], None , None ] :
8690 with utils .TemporaryRepository ('testrepo.zip' , tmp_path ) as path :
8791 yield pygit2 .Repository (path ), path
8892
8993
9094@pytest .fixture
91- def testrepopacked (tmp_path ) :
95+ def testrepopacked (tmp_path : Path ) -> Generator [ Repository , None , None ] :
9296 with utils .TemporaryRepository ('testrepopacked.zip' , tmp_path ) as path :
9397 yield pygit2 .Repository (path )
9498
9599
96100@pytest .fixture
97- def gpgsigned (tmp_path ) :
101+ def gpgsigned (tmp_path : Path ) -> Generator [ Repository , None , None ] :
98102 with utils .TemporaryRepository ('gpgsigned.zip' , tmp_path ) as path :
99103 yield pygit2 .Repository (path )
0 commit comments