diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2023-02-09 08:04:42 -0700 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2023-02-09 08:04:42 -0700 |
commit | 1c2e2be9fbba200330ec84062eecf6662cbd5ee0 (patch) | |
tree | ec89fd7857eacdcb57a189950eac8329f8422972 | |
parent | 712bd2ba1bbf9e9eb51393539378c80f8272fe3b (diff) | |
download | python-coveragepy-git-1c2e2be9fbba200330ec84062eecf6662cbd5ee0.tar.gz |
test: adapt to latest pylint
-rw-r--r-- | ci/download_gha_artifacts.py | 2 | ||||
-rw-r--r-- | ci/parse_relnotes.py | 2 | ||||
-rw-r--r-- | coverage/collector.py | 2 | ||||
-rw-r--r-- | coverage/control.py | 2 | ||||
-rw-r--r-- | coverage/parser.py | 2 | ||||
-rw-r--r-- | pylintrc | 1 | ||||
-rw-r--r-- | tests/test_cmdline.py | 6 | ||||
-rw-r--r-- | tests/test_concurrency.py | 2 |
8 files changed, 10 insertions, 9 deletions
diff --git a/ci/download_gha_artifacts.py b/ci/download_gha_artifacts.py index df22c688..3d20541a 100644 --- a/ci/download_gha_artifacts.py +++ b/ci/download_gha_artifacts.py @@ -21,7 +21,7 @@ def download_url(url, filename): for chunk in response.iter_content(16*1024): f.write(chunk) else: - raise Exception(f"Fetching {url} produced: status={response.status_code}") + raise RuntimeError(f"Fetching {url} produced: status={response.status_code}") def unpack_zipfile(filename): """Unpack a zipfile, using the names in the zip.""" diff --git a/ci/parse_relnotes.py b/ci/parse_relnotes.py index deebae5d..df83818a 100644 --- a/ci/parse_relnotes.py +++ b/ci/parse_relnotes.py @@ -74,7 +74,7 @@ def sections(parsed_data): elif ttype == "text": text.append(ttext) else: - raise Exception(f"Don't know ttype {ttype!r}") + raise RuntimeError(f"Don't know ttype {ttype!r}") yield (*header, "\n".join(text)) diff --git a/coverage/collector.py b/coverage/collector.py index 22471504..2f8c1752 100644 --- a/coverage/collector.py +++ b/coverage/collector.py @@ -356,7 +356,7 @@ class Collector: try: fn(frame, event, arg, lineno=lineno) except TypeError as ex: - raise Exception("fullcoverage must be run with the C trace function.") from ex + raise RuntimeError("fullcoverage must be run with the C trace function.") from ex # Install our installation tracer in threading, to jump-start other # threads. diff --git a/coverage/control.py b/coverage/control.py index 78e0c70e..730ba554 100644 --- a/coverage/control.py +++ b/coverage/control.py @@ -337,7 +337,7 @@ class Coverage(TConfigurable): # '[run] _crash' will raise an exception if the value is close by in # the call stack, for testing error handling. if self.config._crash and self.config._crash in short_stack(limit=4): - raise Exception(f"Crashing because called by {self.config._crash}") + raise RuntimeError(f"Crashing because called by {self.config._crash}") def _write_startup_debug(self) -> None: """Write out debug info at startup if needed.""" diff --git a/coverage/parser.py b/coverage/parser.py index b8ddb501..ae70b4f0 100644 --- a/coverage/parser.py +++ b/coverage/parser.py @@ -821,7 +821,7 @@ class AstArcAnalyzer: # statement), or it's something we overlooked. if env.TESTING: if node_name not in self.OK_TO_DEFAULT: - raise Exception(f"*** Unhandled: {node}") # pragma: only failure + raise RuntimeError(f"*** Unhandled: {node}") # pragma: only failure # Default for simple statements: one exit from this node. return {ArcStart(self.line_for_node(node))} @@ -62,6 +62,7 @@ disable= broad-except, no-else-return, subprocess-run-check, + use-dict-literal, # Messages that may be silly: no-member, using-constant-test, diff --git a/tests/test_cmdline.py b/tests/test_cmdline.py index c517d39d..e94b1080 100644 --- a/tests/test_cmdline.py +++ b/tests/test_cmdline.py @@ -1081,7 +1081,7 @@ class CmdMainTest(CoverageTest): print("Hello, world!") elif argv[0] == 'raise': try: - raise Exception("oh noes!") + raise RuntimeError("oh noes!") except: raise _ExceptionDuringRun(*sys.exc_info()) from None elif argv[0] == 'internalraise': @@ -1111,8 +1111,8 @@ class CmdMainTest(CoverageTest): print(err) err_parts = err.splitlines(keepends=True) assert err_parts[0] == 'Traceback (most recent call last):\n' - assert ' raise Exception("oh noes!")\n' in err_parts - assert err_parts[-1] == 'Exception: oh noes!\n' + assert ' raise RuntimeError("oh noes!")\n' in err_parts + assert err_parts[-1] == 'RuntimeError: oh noes!\n' def test_internalraise(self) -> None: with pytest.raises(ValueError, match="coverage is broken"): diff --git a/tests/test_concurrency.py b/tests/test_concurrency.py index 3360094b..9f12e77e 100644 --- a/tests/test_concurrency.py +++ b/tests/test_concurrency.py @@ -584,7 +584,7 @@ class MultiprocessingTest(CoverageTest): """) out = self.run_command("coverage run multi.py") assert "Exception during multiprocessing bootstrap init" in out - assert "Exception: Crashing because called by _bootstrap" in out + assert "RuntimeError: Crashing because called by _bootstrap" in out def test_bug_890(self) -> None: # chdir in multiprocessing shouldn't keep us from finding the |