File tree Expand file tree Collapse file tree 3 files changed +30
-13
lines changed
src/frequenz/repo/config/nox Expand file tree Collapse file tree 3 files changed +30
-13
lines changed Original file line number Diff line number Diff line change 5252
5353- The distribution package doesn't include tests and other useless files anymore.
5454
55- - nox: When discovering path * extra paths* , now paths will not be added if they are also * source paths* , as we don't want any duplicates.
55+ - nox
56+
57+ * When discovering path * extra paths* , now paths will not be added if they are also * source paths* , as we don't want any duplicates.
58+
59+ * Fix copying of ` Config ` and ` CommandOptions ` objects.
5660
5761### Cookiecutter template
5862
Original file line number Diff line number Diff line change @@ -53,7 +53,16 @@ def copy(self) -> Self:
5353 Returns:
5454 The copy of self.
5555 """
56- return _dataclasses .replace (self )
56+ return _dataclasses .replace (
57+ self ,
58+ black = self .black .copy (),
59+ darglint = self .darglint .copy (),
60+ isort = self .isort .copy (),
61+ mypy = self .mypy .copy (),
62+ pydocstyle = self .pydocstyle .copy (),
63+ pylint = self .pylint .copy (),
64+ pytest = self .pytest .copy (),
65+ )
5766
5867
5968@_dataclasses .dataclass (kw_only = True , slots = True )
@@ -101,7 +110,13 @@ def copy(self, /) -> Self:
101110 Returns:
102111 The copy of self.
103112 """
104- return _dataclasses .replace (self )
113+ return _dataclasses .replace (
114+ self ,
115+ opts = self .opts .copy (),
116+ sessions = self .sessions .copy (),
117+ source_paths = self .source_paths .copy (),
118+ extra_paths = self .extra_paths .copy (),
119+ )
105120
106121 def path_args (self , session : _nox .Session , / ) -> list [str ]:
107122 """Return the file paths to run the checks on.
Original file line number Diff line number Diff line change 2424method.
2525"""
2626
27- import dataclasses
28-
2927from . import config as _config
3028from . import util as _util
3129
8785api_command_options : _config .CommandsOptions = common_command_options .copy ()
8886"""Default command-line options for APIs."""
8987
90- api_config : _config .Config = dataclasses .replace (
91- common_config ,
92- opts = api_command_options ,
93- # We don't check the sources at all because they are automatically generated.
94- source_paths = [],
95- # We adapt the path to the tests.
96- extra_paths = list (_util .replace (common_config .extra_paths , {"tests" : "pytests" })),
97- )
88+ api_config : _config .Config = common_config .copy ()
9889"""Default configuration for APIs.
9990
10091Same as `common_config`, but with `source_paths` replacing `"src"` with `"py"`
10192and `extra_paths` replacing `"tests"` with `"pytests"`.
10293"""
10394
95+ # We don't check the sources at all because they are automatically generated.
96+ api_config .source_paths = []
97+ # We adapt the path to the tests.
98+ api_config .extra_paths = list (
99+ _util .replace (common_config .extra_paths , {"tests" : "pytests" })
100+ )
101+
104102app_command_options : _config .CommandsOptions = common_command_options .copy ()
105103"""Default command-line options for applications."""
106104
You can’t perform that action at this time.
0 commit comments