11import pytest
2- from pkgcore .ebuild .atom import atom as pkgcore_atom
2+ from pkgcore .ebuild .atom import atom as pkgcore_dep
33
4- from pkgcraft .atom import Atom
4+ from pkgcraft .dep import PkgDep as pkgcraft_dep
55from pkgcraft .repo import RepoSet
66
77pytest_plugins = ("benchmark" , "pkgcraft" )
@@ -27,14 +27,14 @@ def test_bench_ebuild_repo_iter(benchmark, lib, ebuild_repo):
2727 assert len (pkgs ) == 100
2828
2929
30- @pytest .mark .parametrize ("lib,func" , (("pkgcraft" , Atom ), ("pkgcore" , pkgcore_atom )))
31- def test_bench_ebuild_repo_iter_restrict_atom (benchmark , lib , func , ebuild_repo ):
30+ @pytest .mark .parametrize ("lib,func" , (("pkgcraft" , pkgcraft_dep ), ("pkgcore" , pkgcore_dep )))
31+ def test_bench_ebuild_repo_iter_restrict_dep (benchmark , lib , func , ebuild_repo ):
3232 # create ebuilds
3333 for i in range (100 ):
3434 ebuild_repo .create_ebuild (f"cat/pkg-{ i } " )
3535
36- # single atom restriction
37- atom = func ("=cat/pkg-50" )
36+ # single dep restriction
37+ dep = func ("=cat/pkg-50" )
3838
3939 if lib == "pkgcore" :
4040 from pkgcore .ebuild import repo_objs , repository
@@ -43,9 +43,9 @@ def test_bench_ebuild_repo_iter_restrict_atom(benchmark, lib, func, ebuild_repo)
4343 location = str (ebuild_repo .path ), disable_inst_caching = True
4444 )
4545 r = repository .UnconfiguredTree (str (ebuild_repo .path ), repo_config = repo_config )
46- pkgs = benchmark (lambda x : list (r .itermatch (x )), atom )
46+ pkgs = benchmark (lambda x : list (r .itermatch (x )), dep )
4747 else :
48- pkgs = benchmark (lambda x : list (ebuild_repo .iter_restrict (x )), atom )
48+ pkgs = benchmark (lambda x : list (ebuild_repo .iter_restrict (x )), dep )
4949
5050 assert len (pkgs ) == 1
5151 assert str (pkgs [0 ].version ) == "50"
@@ -58,14 +58,14 @@ def test_bench_fake_repo_iter(benchmark, fake_repo):
5858 assert len (pkgs ) == 100
5959
6060
61- def test_bench_fake_repo_iter_restrict_atom (benchmark , fake_repo ):
61+ def test_bench_fake_repo_iter_restrict_dep (benchmark , fake_repo ):
6262 # create pkgs
6363 fake_repo .extend ([f"cat/pkg-{ i } " for i in range (100 )])
6464
65- # single atom restriction
66- atom = Atom ("=cat/pkg-50" )
65+ # single dep restriction
66+ dep = pkgcraft_dep ("=cat/pkg-50" )
6767
68- pkgs = benchmark (lambda x : list (fake_repo .iter_restrict (x )), atom )
68+ pkgs = benchmark (lambda x : list (fake_repo .iter_restrict (x )), dep )
6969 assert len (pkgs ) == 1
7070 assert str (pkgs [0 ].version ) == "50"
7171
@@ -84,7 +84,7 @@ def test_bench_repo_set_iter(benchmark, make_ebuild_repo):
8484 assert len (pkgs ) == 100
8585
8686
87- def test_bench_repo_set_iter_restrict_atom (benchmark , make_ebuild_repo ):
87+ def test_bench_repo_set_iter_restrict_dep (benchmark , make_ebuild_repo ):
8888 r1 = make_ebuild_repo ()
8989 r2 = make_ebuild_repo ()
9090 # create ebuilds
@@ -93,11 +93,11 @@ def test_bench_repo_set_iter_restrict_atom(benchmark, make_ebuild_repo):
9393 for i in range (50 , 100 ):
9494 r2 .create_ebuild (f"cat/pkg-{ i } " )
9595
96- # single atom restriction
97- atom = Atom ("=cat/pkg-50" )
96+ # single dep restriction
97+ dep = pkgcraft_dep ("=cat/pkg-50" )
9898
9999 repos = RepoSet (r1 , r2 )
100- pkgs = benchmark (lambda x : list (repos .iter_restrict (x )), atom )
100+ pkgs = benchmark (lambda x : list (repos .iter_restrict (x )), dep )
101101
102102 assert len (pkgs ) == 1
103103 assert str (pkgs [0 ].version ) == "50"
0 commit comments