Skip to content

Commit 1e331db

Browse files
committed
Update pre-commit configs
- pre-commit autoupdate - upadup - apply fixes
1 parent 3de648a commit 1e331db

File tree

8 files changed

+19
-23
lines changed

8 files changed

+19
-23
lines changed

.pre-commit-config.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks.git
3-
rev: v4.5.0
3+
rev: v4.6.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.27.3
11+
rev: 0.28.2
1212
hooks:
1313
- id: check-github-workflows
1414
- id: check-dependabot
1515
- id: check-readthedocs
1616
- repo: https://github.com/psf/black
17-
rev: 24.1.1
17+
rev: 24.4.2
1818
hooks:
1919
- id: black
2020
language_version: python3
@@ -23,7 +23,7 @@ repos:
2323
hooks:
2424
- id: isort
2525
- repo: https://github.com/asottile/pyupgrade
26-
rev: v3.15.0
26+
rev: v3.15.2
2727
hooks:
2828
- id: pyupgrade
2929
args: ["--py37-plus"]
@@ -32,11 +32,11 @@ repos:
3232
hooks:
3333
- id: flake8
3434
additional_dependencies:
35-
- 'flake8-bugbear==23.12.2'
35+
- 'flake8-bugbear==24.4.26'
3636
- 'flake8-comprehensions==3.14.0'
3737
- 'flake8-typing-as-t==0.0.3'
3838
- repo: https://github.com/sirosen/slyp
39-
rev: 0.1.2
39+
rev: 0.6.1
4040
hooks:
4141
- id: slyp
4242
- repo: https://github.com/codespell-project/codespell
@@ -46,7 +46,7 @@ repos:
4646
additional_dependencies:
4747
- tomli
4848
- repo: https://github.com/tox-dev/pyproject-fmt
49-
rev: 1.7.0
49+
rev: 1.8.0
5050
hooks:
5151
- id: pyproject-fmt
5252
additional_dependencies: ["tox>=4.9"]

nose2/main.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def parseArgs(self, argv):
111111
self.argparse.add_argument("testNames", nargs="*")
112112
# add help arg now so -h will also print plugin opts
113113
self.argparse.add_argument(
114-
"-h", "--help", action="help", help=("Show this help message and exit")
114+
"-h", "--help", action="help", help="Show this help message and exit"
115115
)
116116
args, argv = self.argparse.parse_known_args(argv)
117117
if argv:
@@ -185,7 +185,7 @@ def setInitialArguments(self):
185185
self.argparse.add_argument(
186186
"--verbosity",
187187
type=int,
188-
help=("Set starting verbosity level (int). Applies before -v and -q"),
188+
help="Set starting verbosity level (int). Applies before -v and -q",
189189
)
190190
self.argparse.add_argument(
191191
"--verbose",
@@ -203,7 +203,7 @@ def setInitialArguments(self):
203203
action="count",
204204
default=0,
205205
dest="quiet",
206-
help=("Reduce verbosity. Multiple '-q's result in lower verbosity."),
206+
help="Reduce verbosity. Multiple '-q's result in lower verbosity.",
207207
)
208208
self.argparse.add_argument(
209209
"--log-level",
@@ -305,7 +305,7 @@ def runTests(self):
305305
self.result = runner.run(self.test)
306306
except Exception as e:
307307
log.exception("Internal Error")
308-
sys.stderr.write("Internal Error: runTests aborted: %s\n" % (e))
308+
sys.stderr.write("Internal Error: runTests aborted: %s\n" % e)
309309
if self.exit:
310310
sys.exit(1)
311311
if self.exit:

nose2/plugins/loader/discovery.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def loadTestsFromName(self, event):
7373
module = sys.modules[name]
7474
except (KeyboardInterrupt, SystemExit):
7575
raise
76-
except BaseException:
76+
except BaseException: # noqa: B036
7777
# if that fails, try it as a file or directory
7878
event.extraTests.extend(self._find_tests(event, name, top_level_dir))
7979
else:
@@ -193,7 +193,7 @@ def _find_tests_in_file(
193193
util.ensure_importable(package_path)
194194
try:
195195
module = util.module_from_name(module_name)
196-
except BaseException:
196+
except BaseException: # noqa: B036
197197
yield loader.failedImport(module_name)
198198
else:
199199
mod_file = os.path.abspath(getattr(module, "__file__", full_path))

nose2/plugins/loader/testclasses.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def _loadTestsFromTestClass(self, event, cls):
154154
for name in names
155155
]
156156
)
157-
except BaseException:
157+
except BaseException: # noqa: B036
158158
return event.loader.suiteClass(
159159
event.loader.failedLoadTests(cls.__name__, sys.exc_info())
160160
)

nose2/sphinxext.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def add_config(self, rst, config, plugin):
135135
rst.append(" [%s]" % config.section, AD)
136136
for var in sorted(config.vars.keys()):
137137
info = config.vars[var]
138-
entry = " %s = " % (var)
138+
entry = " %s = " % var
139139
if info["type"] == "list":
140140
if info["default"]:
141141
pad = " " * len(entry)

nose2/suite.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def _safeMethodCall(self, method, result, *args):
125125
return True
126126
except KeyboardInterrupt:
127127
raise
128-
except BaseException:
128+
except BaseException: # noqa: B036
129129
result.addError(self, sys.exc_info())
130130
return False
131131

nose2/tests/functional/test_printhooks_plugin.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,15 @@ def test_invocation_by_double_dash_option(self):
88
proc = self.runIn(
99
"scenario/no_tests", "--plugin=nose2.plugins.printhooks", "--print-hooks"
1010
)
11-
match = re.compile(
12-
"\n" + r"handleArgs: CommandLineArgsEvent\(handled=False, args="
13-
)
11+
match = re.compile("\nhandleArgs: CommandLineArgsEvent\\(handled=False, args=")
1412
self.assertTestRunOutputMatches(proc, stderr=match)
1513
self.assertEqual(proc.poll(), 0)
1614

1715
def test_invocation_by_single_dash_option(self):
1816
proc = self.runIn(
1917
"scenario/no_tests", "--plugin=nose2.plugins.printhooks", "-P"
2018
)
21-
match = re.compile(
22-
"\n" + r"handleArgs: CommandLineArgsEvent\(handled=False, args="
23-
)
19+
match = re.compile("\nhandleArgs: CommandLineArgsEvent\\(handled=False, args=")
2420
self.assertTestRunOutputMatches(proc, stderr=match)
2521
self.assertEqual(proc.poll(), 0)
2622

nose2/tests/functional/test_verbosity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Ran 1 test """
66

77
Q_TEST_PATTERN = r"(?<!\.)(?<!ok)" + _SUFFIX
8-
MID_TEST_PATTERN = r"\." + "\n" + _SUFFIX
8+
MID_TEST_PATTERN = "\\.\n" + _SUFFIX
99
V_TEST_PATTERN = (
1010
r"test \(__main__\.Test" + _method_name() + r"\) \.\.\. ok" + "\n\n" + _SUFFIX
1111
)

0 commit comments

Comments
 (0)