8
8
from _pytest .config import ExitCode
9
9
from _pytest .monkeypatch import MonkeyPatch
10
10
from _pytest .pytester import Pytester
11
+ from _pytest .tmpdir import TempPathFactory
11
12
12
13
pytest_plugins = ("pytester" ,)
13
14
@@ -139,9 +140,11 @@ def test_custom_rel_cache_dir(self, pytester: Pytester) -> None:
139
140
pytester .runpytest ()
140
141
assert pytester .path .joinpath (rel_cache_dir ).is_dir ()
141
142
142
- def test_custom_abs_cache_dir (self , pytester : Pytester , tmpdir_factory ) -> None :
143
- tmp = str (tmpdir_factory .mktemp ("tmp" ))
144
- abs_cache_dir = os .path .join (tmp , "custom_cache_dir" )
143
+ def test_custom_abs_cache_dir (
144
+ self , pytester : Pytester , tmp_path_factory : TempPathFactory
145
+ ) -> None :
146
+ tmp = tmp_path_factory .mktemp ("tmp" )
147
+ abs_cache_dir = tmp / "custom_cache_dir"
145
148
pytester .makeini (
146
149
"""
147
150
[pytest]
@@ -152,7 +155,7 @@ def test_custom_abs_cache_dir(self, pytester: Pytester, tmpdir_factory) -> None:
152
155
)
153
156
pytester .makepyfile (test_errored = "def test_error():\n assert False" )
154
157
pytester .runpytest ()
155
- assert Path ( abs_cache_dir ) .is_dir ()
158
+ assert abs_cache_dir .is_dir ()
156
159
157
160
def test_custom_cache_dir_with_env_var (
158
161
self , pytester : Pytester , monkeypatch : MonkeyPatch
@@ -185,9 +188,9 @@ def test_cache_reportheader(env, pytester: Pytester, monkeypatch: MonkeyPatch) -
185
188
186
189
187
190
def test_cache_reportheader_external_abspath (
188
- pytester : Pytester , tmpdir_factory
191
+ pytester : Pytester , tmp_path_factory : TempPathFactory
189
192
) -> None :
190
- external_cache = tmpdir_factory .mktemp (
193
+ external_cache = tmp_path_factory .mktemp (
191
194
"test_cache_reportheader_external_abspath_abs"
192
195
)
193
196
0 commit comments