@@ -62,62 +62,46 @@ def basedir(
6262 def test_basic_init (self , basedir : Path ) -> None :
6363 conftest = PytestPluginManager ()
6464 p = basedir / "adir"
65- assert (
66- conftest ._rget_with_confmod ("a" , p , importmode = "prepend" , rootpath = basedir )[
67- 1
68- ]
69- == 1
70- )
65+ conftest ._loadconftestmodules (p , importmode = "prepend" , rootpath = basedir )
66+ assert conftest ._rget_with_confmod ("a" , p )[1 ] == 1
7167
7268 def test_immediate_initialiation_and_incremental_are_the_same (
7369 self , basedir : Path
7470 ) -> None :
7571 conftest = PytestPluginManager ()
7672 assert not len (conftest ._dirpath2confmods )
77- conftest ._getconftestmodules (
78- basedir , importmode = "prepend" , rootpath = Path (basedir )
79- )
73+ conftest ._loadconftestmodules (basedir , importmode = "prepend" , rootpath = basedir )
8074 snap1 = len (conftest ._dirpath2confmods )
8175 assert snap1 == 1
82- conftest ._getconftestmodules (
76+ conftest ._loadconftestmodules (
8377 basedir / "adir" , importmode = "prepend" , rootpath = basedir
8478 )
8579 assert len (conftest ._dirpath2confmods ) == snap1 + 1
86- conftest ._getconftestmodules (
80+ conftest ._loadconftestmodules (
8781 basedir / "b" , importmode = "prepend" , rootpath = basedir
8882 )
8983 assert len (conftest ._dirpath2confmods ) == snap1 + 2
9084
9185 def test_value_access_not_existing (self , basedir : Path ) -> None :
9286 conftest = ConftestWithSetinitial (basedir )
9387 with pytest .raises (KeyError ):
94- conftest ._rget_with_confmod (
95- "a" , basedir , importmode = "prepend" , rootpath = Path (basedir )
96- )
88+ conftest ._rget_with_confmod ("a" , basedir )
9789
9890 def test_value_access_by_path (self , basedir : Path ) -> None :
9991 conftest = ConftestWithSetinitial (basedir )
10092 adir = basedir / "adir"
101- assert (
102- conftest ._rget_with_confmod (
103- "a" , adir , importmode = "prepend" , rootpath = basedir
104- )[1 ]
105- == 1
106- )
107- assert (
108- conftest ._rget_with_confmod (
109- "a" , adir / "b" , importmode = "prepend" , rootpath = basedir
110- )[1 ]
111- == 1.5
93+ conftest ._loadconftestmodules (adir , importmode = "prepend" , rootpath = basedir )
94+ assert conftest ._rget_with_confmod ("a" , adir )[1 ] == 1
95+ conftest ._loadconftestmodules (
96+ adir / "b" , importmode = "prepend" , rootpath = basedir
11297 )
98+ assert conftest ._rget_with_confmod ("a" , adir / "b" )[1 ] == 1.5
11399
114100 def test_value_access_with_confmod (self , basedir : Path ) -> None :
115101 startdir = basedir / "adir" / "b"
116102 startdir .joinpath ("xx" ).mkdir ()
117103 conftest = ConftestWithSetinitial (startdir )
118- mod , value = conftest ._rget_with_confmod (
119- "a" , startdir , importmode = "prepend" , rootpath = Path (basedir )
120- )
104+ mod , value = conftest ._rget_with_confmod ("a" , startdir )
121105 assert value == 1.5
122106 assert mod .__file__ is not None
123107 path = Path (mod .__file__ )
@@ -143,9 +127,7 @@ def test_doubledash_considered(pytester: Pytester) -> None:
143127 conf .joinpath ("conftest.py" ).touch ()
144128 conftest = PytestPluginManager ()
145129 conftest_setinitial (conftest , [conf .name , conf .name ])
146- values = conftest ._getconftestmodules (
147- conf , importmode = "prepend" , rootpath = pytester .path
148- )
130+ values = conftest ._getconftestmodules (conf )
149131 assert len (values ) == 1
150132
151133
@@ -192,26 +174,22 @@ def test_conftestcutdir(pytester: Pytester) -> None:
192174 p = pytester .mkdir ("x" )
193175 conftest = PytestPluginManager ()
194176 conftest_setinitial (conftest , [pytester .path ], confcutdir = p )
195- values = conftest ._getconftestmodules (
196- p , importmode = "prepend" , rootpath = pytester .path
197- )
177+ conftest ._loadconftestmodules (p , importmode = "prepend" , rootpath = pytester .path )
178+ values = conftest ._getconftestmodules (p )
198179 assert len (values ) == 0
199- values = conftest ._getconftestmodules (
180+ conftest ._loadconftestmodules (
200181 conf .parent , importmode = "prepend" , rootpath = pytester .path
201182 )
183+ values = conftest ._getconftestmodules (conf .parent )
202184 assert len (values ) == 0
203185 assert not conftest .has_plugin (str (conf ))
204186 # but we can still import a conftest directly
205187 conftest ._importconftest (conf , importmode = "prepend" , rootpath = pytester .path )
206- values = conftest ._getconftestmodules (
207- conf .parent , importmode = "prepend" , rootpath = pytester .path
208- )
188+ values = conftest ._getconftestmodules (conf .parent )
209189 assert values [0 ].__file__ is not None
210190 assert values [0 ].__file__ .startswith (str (conf ))
211191 # and all sub paths get updated properly
212- values = conftest ._getconftestmodules (
213- p , importmode = "prepend" , rootpath = pytester .path
214- )
192+ values = conftest ._getconftestmodules (p )
215193 assert len (values ) == 1
216194 assert values [0 ].__file__ is not None
217195 assert values [0 ].__file__ .startswith (str (conf ))
@@ -221,9 +199,7 @@ def test_conftestcutdir_inplace_considered(pytester: Pytester) -> None:
221199 conf = pytester .makeconftest ("" )
222200 conftest = PytestPluginManager ()
223201 conftest_setinitial (conftest , [conf .parent ], confcutdir = conf .parent )
224- values = conftest ._getconftestmodules (
225- conf .parent , importmode = "prepend" , rootpath = pytester .path
226- )
202+ values = conftest ._getconftestmodules (conf .parent )
227203 assert len (values ) == 1
228204 assert values [0 ].__file__ is not None
229205 assert values [0 ].__file__ .startswith (str (conf ))
@@ -433,10 +409,8 @@ def impct(p, importmode, root):
433409 conftest = PytestPluginManager ()
434410 conftest ._confcutdir = pytester .path
435411 monkeypatch .setattr (conftest , "_importconftest" , impct )
436- mods = cast (
437- List [Path ],
438- conftest ._getconftestmodules (sub , importmode = "prepend" , rootpath = pytester .path ),
439- )
412+ conftest ._loadconftestmodules (sub , importmode = "prepend" , rootpath = pytester .path )
413+ mods = cast (List [Path ], conftest ._getconftestmodules (sub ))
440414 expected = [ct1 , ct2 ]
441415 assert mods == expected
442416
0 commit comments