File tree Expand file tree Collapse file tree 3 files changed +7
-2
lines changed Expand file tree Collapse file tree 3 files changed +7
-2
lines changed Original file line number Diff line number Diff line change 21
21
import argparse
22
22
import collections
23
23
import functools
24
+ import os
24
25
from argparse import ArgumentError , ArgumentParser , Namespace
25
26
from collections .abc import Callable , Iterable
26
27
from typing import TYPE_CHECKING , Any , Literal
@@ -47,6 +48,7 @@ def __dir__() -> list[str]:
47
48
48
49
49
50
av_opt_str = av .optional (av .instance_of (str ))
51
+ av_opt_path = av .optional (av .or_ (av .instance_of (str ), av .instance_of (os .PathLike )))
50
52
av_opt_list_str = av .optional (
51
53
av .deep_iterable (
52
54
member_validator = av .instance_of (str ),
@@ -59,7 +61,7 @@ def __dir__() -> list[str]:
59
61
@attrs .define (slots = True , kw_only = True )
60
62
class NoxOptions :
61
63
default_venv_backend : None | str = attrs .field (validator = av_opt_str )
62
- envdir : None | str = attrs .field (validator = av_opt_str )
64
+ envdir : None | str | os . PathLike [ str ] = attrs .field (validator = av_opt_path )
63
65
error_on_external_run : bool = attrs .field (validator = av_bool )
64
66
error_on_missing_interpreters : bool = attrs .field (validator = av_bool )
65
67
force_venv_backend : None | str = attrs .field (validator = av_opt_str )
Original file line number Diff line number Diff line change @@ -157,7 +157,7 @@ def _envdir_merge_func(
157
157
noxfile_Args (NoxOptions): The options specified in the
158
158
Noxfile.
159
159
"""
160
- return command_args .envdir or noxfile_args .envdir or ".nox"
160
+ return os . fspath ( command_args .envdir or noxfile_args .envdir or ".nox" )
161
161
162
162
163
163
def _reuse_venv_merge_func (
Original file line number Diff line number Diff line change @@ -154,3 +154,6 @@ def test_validation_options(self) -> None:
154
154
options .sessions = ("testytest" ,)
155
155
with pytest .raises (ValueError ): # noqa: PT011
156
156
options .sessions = "testytest"
157
+
158
+ options .envdir = "envdir"
159
+ options .envdir = Path ("envdir" )
You can’t perform that action at this time.
0 commit comments