Skip to content

Commit 335d549

Browse files
authored
Merge pull request #645 from nose-devs/update-precommit-hooks
Update pre-commit config + apply changes
2 parents 80d7649 + b1987a5 commit 335d549

File tree

14 files changed

+43
-56
lines changed

14 files changed

+43
-56
lines changed

.pre-commit-config.yaml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks.git
3-
rev: v5.0.0
3+
rev: v6.0.0
44
hooks:
55
- id: check-merge-conflict
66
- id: check-toml
77
- id: check-yaml
88
- id: end-of-file-fixer
99
- id: trailing-whitespace
1010
- repo: https://github.com/python-jsonschema/check-jsonschema
11-
rev: 0.33.0
11+
rev: 0.36.1
1212
hooks:
1313
- id: check-github-workflows
1414
- id: check-dependabot
1515
- id: check-readthedocs
1616
- repo: https://github.com/psf/black
17-
rev: 25.1.0
17+
rev: 26.1.0
1818
hooks:
1919
- id: black
2020
language_version: python3
2121
- repo: https://github.com/PyCQA/isort
22-
rev: 6.0.1
22+
rev: 7.0.0
2323
hooks:
2424
- id: isort
2525
- repo: https://github.com/asottile/pyupgrade
26-
rev: v3.19.1
26+
rev: v3.21.2
2727
hooks:
2828
- id: pyupgrade
2929
args: ["--py37-plus"]
3030
- repo: https://github.com/PyCQA/flake8
31-
rev: 7.2.0
31+
rev: 7.3.0
3232
hooks:
3333
- id: flake8
3434
additional_dependencies:
35-
- 'flake8-bugbear==24.12.12'
36-
- 'flake8-comprehensions==3.16.0'
37-
- 'flake8-typing-as-t==1.0.0'
35+
- 'flake8-bugbear==25.11.29'
36+
- 'flake8-comprehensions==3.17.0'
37+
- 'flake8-typing-as-t==1.1.0'
3838
- repo: https://github.com/sirosen/slyp
3939
rev: 0.8.2
4040
hooks:
@@ -49,7 +49,8 @@ repos:
4949
- "-L"
5050
- "assertIn"
5151
- repo: https://github.com/tox-dev/pyproject-fmt
52-
rev: v2.5.1
52+
rev: v2.16.0
5353
hooks:
5454
- id: pyproject-fmt
55+
args: ["--max-supported-python", "3.13"]
5556
additional_dependencies: ["tox>=4.9"]

nose2/plugins/loader/parameters.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def _method(self, method=method, argSet=argSet):
169169
return method(self, *argSet)
170170

171171
_method = functools.update_wrapper(_method, method)
172-
delattr(_method, "paramList")
172+
del _method.paramList
173173
setattr(testCaseClass, method_name, _method)
174174
names.append(method_name)
175175
return names
@@ -188,7 +188,7 @@ def func(argSet=argSet, obj=obj):
188188
return obj(*argSet)
189189

190190
func = functools.update_wrapper(func, obj)
191-
delattr(func, "paramList")
191+
del func.paramList
192192
name = f"{obj.__module__}.{obj.__name__}"
193193
func_name = util.name_from_args(name, index, argSet)
194194
yield util.transplant_class(ParamsFunctionCase, obj.__module__)(

nose2/plugins/prettyassert.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,9 @@ def _get_inspection_info(trace):
137137
- statement which failed (which can be garbage -- don't trust it)
138138
- can_tokenize: a bool indicating that the lines of source can be parsed
139139
"""
140-
(frame, fname, lineno, funcname, context, ctx_index) = inspect.getinnerframes(
141-
trace
142-
)[-1]
140+
frame, fname, lineno, funcname, context, ctx_index = inspect.getinnerframes(trace)[
141+
-1
142+
]
143143
original_source_lines, firstlineno = inspect.getsourcelines(frame)
144144

145145
# truncate to the code in this frame to remove anything after current

nose2/suite.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def tearDownTest(self, test):
105105

106106
event = events.StopLayerTeardownTestEvent(self.layer, test)
107107
self.session.hooks.stopLayerTeardownTest(event)
108-
delattr(test, "_layer_wasSetUp")
108+
del test._layer_wasSetUp
109109

110110
def tearDown(self):
111111
if self.layer is None:

nose2/tests/functional/support/such/test_such.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ def test_setup(case):
124124

125125
@it.has_test_teardown
126126
def test_teardown(case):
127-
delattr(it, "is_funny")
128-
delattr(case, "is_funny")
127+
del it.is_funny
128+
del case.is_funny
129129

130130
@it.should("do something else") # type: ignore[no-redef]
131131
def test(case): # noqa: F811
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
[tool.nose2.a]
2-
a = 1
3-
4-
[tool.nose2.unittest]
5-
plugins = "plugin_a"
1+
[tool.nose2]
2+
a.a = 1
3+
unittest.plugins = "plugin_a"
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
[tool.nose2.b]
2-
b = """
1+
[tool.nose2]
2+
b.b = """
33
4
44
5
55
"""

nose2/tests/functional/test_collect_plugin.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ def test_collect_tests_in_package(self):
1717

1818

1919
# expectations
20-
EXPECT_LAYOUT1 = re.compile(
21-
r"""Ran 25 tests in \d.\d+s
20+
EXPECT_LAYOUT1 = re.compile(r"""Ran 25 tests in \d.\d+s
2221
23-
OK"""
24-
)
22+
OK""")

nose2/tests/functional/test_mp_plugin.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -82,20 +82,20 @@ def test_flatten_respects_class_fixtures(self):
8282

8383
def test_conn_prep(self):
8484
self.plugin.bind_host = None
85-
(parent_conn, child_conn) = self.plugin._prepConns()
86-
(parent_pipe, child_pipe) = multiprocessing.Pipe()
85+
parent_conn, child_conn = self.plugin._prepConns()
86+
parent_pipe, child_pipe = multiprocessing.Pipe()
8787
self.assertIsInstance(parent_conn, type(parent_pipe))
8888
self.assertIsInstance(child_conn, type(child_pipe))
8989

9090
self.plugin.bind_host = "127.0.0.1"
9191
self.plugin.bind_port = 0
92-
(parent_conn, child_conn) = self.plugin._prepConns()
92+
parent_conn, child_conn = self.plugin._prepConns()
9393
self.assertIsInstance(parent_conn, connection.Listener)
9494
self.assertIsInstance(child_conn, tuple)
9595
self.assertEqual(parent_conn.address, child_conn[:2])
9696

9797
def test_conn_accept(self):
98-
(parent_conn, child_conn) = multiprocessing.Pipe()
98+
parent_conn, child_conn = multiprocessing.Pipe()
9999
self.assertEqual(self.plugin._acceptConns(parent_conn), parent_conn)
100100

101101
listener = connection.Listener(("127.0.0.1", 0))
@@ -161,27 +161,23 @@ def test_dispatch_tests_receive_events(self):
161161
{
162162
"outcome": "failed",
163163
"expected": False,
164-
"metadata": {
165-
"stdout": """\
164+
"metadata": {"stdout": """\
166165
-------------------- >> begin captured stdout << ---------------------
167166
Hello stdout
168167
169-
--------------------- >> end captured stdout << ----------------------"""
170-
},
168+
--------------------- >> end captured stdout << ----------------------"""},
171169
},
172170
),
173171
(
174172
"testOutcome",
175173
{
176174
"outcome": "failed",
177175
"expected": False,
178-
"metadata": {
179-
"stdout": """\
176+
"metadata": {"stdout": """\
180177
-------------------- >> begin captured stdout << ---------------------
181178
Hello stdout
182179
183-
--------------------- >> end captured stdout << ----------------------"""
184-
},
180+
--------------------- >> end captured stdout << ----------------------"""},
185181
},
186182
),
187183
("stopTest", {}),

nose2/tests/unit/test_collector.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,10 @@ class TestCollector(TestCase):
1212

1313
def test_collector_completes_with_no_tests(self):
1414
with open("unittest.cfg", "w") as ut_file:
15-
ut_file.write(
16-
dedent(
17-
"""
15+
ut_file.write(dedent("""
1816
[unittest]
1917
quiet = true
20-
"""
21-
)
22-
)
18+
"""))
2319
test = collector.collector()
2420
with RedirectStdStreams() as redir:
2521
self.assertRaises(SystemExit, test.run, None)

0 commit comments

Comments
 (0)