File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -53,17 +53,18 @@ def __init__(
53
53
def from_request (
54
54
cls : type [TempUPathFactory ],
55
55
request : pytest .FixtureRequest ,
56
+ tmp_path_factory : pytest .TempPathFactory | None = None ,
56
57
* args ,
57
58
** kwargs ,
58
59
) -> TempUPathFactory :
59
60
"""Create a factory according to pytest configuration."""
60
- tmp_upath_factory = cls (* args , ** kwargs )
61
- tmp_upath_factory ._local_path_factory = ( # noqa: SLF001
62
- pytest .TempPathFactory .from_config (
61
+ if tmp_path_factory is None :
62
+ tmp_path_factory = pytest .TempPathFactory .from_config (
63
63
request .config ,
64
64
_ispytest = True ,
65
65
)
66
- )
66
+ tmp_upath_factory = cls (* args , ** kwargs )
67
+ tmp_upath_factory ._local_path_factory = tmp_path_factory # noqa: SLF001
67
68
tmp_upath_factory ._request = request # noqa: SLF001
68
69
69
70
return tmp_upath_factory
Original file line number Diff line number Diff line change @@ -23,9 +23,12 @@ def versioning(): # noqa: ANN201
23
23
24
24
25
25
@pytest .fixture (scope = "session" )
26
- def tmp_upath_factory (request : pytest .FixtureRequest ) -> TempUPathFactory :
26
+ def tmp_upath_factory (
27
+ request : pytest .FixtureRequest ,
28
+ tmp_path_factory : pytest .TempPathFactory ,
29
+ ) -> TempUPathFactory :
27
30
"""Return a TempUPathFactory instance for the test session."""
28
- return TempUPathFactory .from_request (request )
31
+ return TempUPathFactory .from_request (request , tmp_path_factory )
29
32
30
33
31
34
@pytest .fixture
You can’t perform that action at this time.
0 commit comments