Skip to content

Commit

Permalink
Update pre-commit configs
Browse files Browse the repository at this point in the history
- pre-commit autoupdate
- upadup
- apply fixes
  • Loading branch information
sirosen committed Apr 28, 2024
1 parent 3de648a commit 1e331db
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 23 deletions.
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks.git
rev: v4.5.0
rev: v4.6.0
hooks:
- id: check-merge-conflict
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.27.3
rev: 0.28.2
hooks:
- id: check-github-workflows
- id: check-dependabot
- id: check-readthedocs
- repo: https://github.com/psf/black
rev: 24.1.1
rev: 24.4.2
hooks:
- id: black
language_version: python3
Expand All @@ -23,7 +23,7 @@ repos:
hooks:
- id: isort
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
rev: v3.15.2
hooks:
- id: pyupgrade
args: ["--py37-plus"]
Expand All @@ -32,11 +32,11 @@ repos:
hooks:
- id: flake8
additional_dependencies:
- 'flake8-bugbear==23.12.2'
- 'flake8-bugbear==24.4.26'
- 'flake8-comprehensions==3.14.0'
- 'flake8-typing-as-t==0.0.3'
- repo: https://github.com/sirosen/slyp
rev: 0.1.2
rev: 0.6.1
hooks:
- id: slyp
- repo: https://github.com/codespell-project/codespell
Expand All @@ -46,7 +46,7 @@ repos:
additional_dependencies:
- tomli
- repo: https://github.com/tox-dev/pyproject-fmt
rev: 1.7.0
rev: 1.8.0
hooks:
- id: pyproject-fmt
additional_dependencies: ["tox>=4.9"]
8 changes: 4 additions & 4 deletions nose2/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def parseArgs(self, argv):
self.argparse.add_argument("testNames", nargs="*")
# add help arg now so -h will also print plugin opts
self.argparse.add_argument(
"-h", "--help", action="help", help=("Show this help message and exit")
"-h", "--help", action="help", help="Show this help message and exit"
)
args, argv = self.argparse.parse_known_args(argv)
if argv:
Expand Down Expand Up @@ -185,7 +185,7 @@ def setInitialArguments(self):
self.argparse.add_argument(
"--verbosity",
type=int,
help=("Set starting verbosity level (int). Applies before -v and -q"),
help="Set starting verbosity level (int). Applies before -v and -q",
)
self.argparse.add_argument(
"--verbose",
Expand All @@ -203,7 +203,7 @@ def setInitialArguments(self):
action="count",
default=0,
dest="quiet",
help=("Reduce verbosity. Multiple '-q's result in lower verbosity."),
help="Reduce verbosity. Multiple '-q's result in lower verbosity.",
)
self.argparse.add_argument(
"--log-level",
Expand Down Expand Up @@ -305,7 +305,7 @@ def runTests(self):
self.result = runner.run(self.test)
except Exception as e:
log.exception("Internal Error")
sys.stderr.write("Internal Error: runTests aborted: %s\n" % (e))
sys.stderr.write("Internal Error: runTests aborted: %s\n" % e)
if self.exit:
sys.exit(1)
if self.exit:
Expand Down
4 changes: 2 additions & 2 deletions nose2/plugins/loader/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def loadTestsFromName(self, event):
module = sys.modules[name]
except (KeyboardInterrupt, SystemExit):
raise
except BaseException:
except BaseException: # noqa: B036
# if that fails, try it as a file or directory
event.extraTests.extend(self._find_tests(event, name, top_level_dir))
else:
Expand Down Expand Up @@ -193,7 +193,7 @@ def _find_tests_in_file(
util.ensure_importable(package_path)
try:
module = util.module_from_name(module_name)
except BaseException:
except BaseException: # noqa: B036
yield loader.failedImport(module_name)
else:
mod_file = os.path.abspath(getattr(module, "__file__", full_path))
Expand Down
2 changes: 1 addition & 1 deletion nose2/plugins/loader/testclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def _loadTestsFromTestClass(self, event, cls):
for name in names
]
)
except BaseException:
except BaseException: # noqa: B036
return event.loader.suiteClass(
event.loader.failedLoadTests(cls.__name__, sys.exc_info())
)
Expand Down
2 changes: 1 addition & 1 deletion nose2/sphinxext.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def add_config(self, rst, config, plugin):
rst.append(" [%s]" % config.section, AD)
for var in sorted(config.vars.keys()):
info = config.vars[var]
entry = " %s = " % (var)
entry = " %s = " % var
if info["type"] == "list":
if info["default"]:
pad = " " * len(entry)
Expand Down
2 changes: 1 addition & 1 deletion nose2/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def _safeMethodCall(self, method, result, *args):
return True
except KeyboardInterrupt:
raise
except BaseException:
except BaseException: # noqa: B036
result.addError(self, sys.exc_info())
return False

Expand Down
8 changes: 2 additions & 6 deletions nose2/tests/functional/test_printhooks_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,15 @@ def test_invocation_by_double_dash_option(self):
proc = self.runIn(
"scenario/no_tests", "--plugin=nose2.plugins.printhooks", "--print-hooks"
)
match = re.compile(
"\n" + r"handleArgs: CommandLineArgsEvent\(handled=False, args="
)
match = re.compile("\nhandleArgs: CommandLineArgsEvent\\(handled=False, args=")
self.assertTestRunOutputMatches(proc, stderr=match)
self.assertEqual(proc.poll(), 0)

def test_invocation_by_single_dash_option(self):
proc = self.runIn(
"scenario/no_tests", "--plugin=nose2.plugins.printhooks", "-P"
)
match = re.compile(
"\n" + r"handleArgs: CommandLineArgsEvent\(handled=False, args="
)
match = re.compile("\nhandleArgs: CommandLineArgsEvent\\(handled=False, args=")
self.assertTestRunOutputMatches(proc, stderr=match)
self.assertEqual(proc.poll(), 0)

Expand Down
2 changes: 1 addition & 1 deletion nose2/tests/functional/test_verbosity.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Ran 1 test """

Q_TEST_PATTERN = r"(?<!\.)(?<!ok)" + _SUFFIX
MID_TEST_PATTERN = r"\." + "\n" + _SUFFIX
MID_TEST_PATTERN = "\\.\n" + _SUFFIX
V_TEST_PATTERN = (
r"test \(__main__\.Test" + _method_name() + r"\) \.\.\. ok" + "\n\n" + _SUFFIX
)
Expand Down

0 comments on commit 1e331db

Please sign in to comment.