diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2021-07-28 19:48:10 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2021-07-28 19:48:10 -0400 |
commit | 7fe106b9fef26478ba10a6f206baf70eee201d4a (patch) | |
tree | a6e35aafeeea8887899433f5067f00569950ff44 /coverage/execfile.py | |
parent | c5c1ba084b0b548ff8869cbc086e81608c329eb6 (diff) | |
download | python-coveragepy-git-7fe106b9fef26478ba10a6f206baf70eee201d4a.tar.gz |
fix: correct previous refactorings
File names should not be rendered with !r, since on Windows that will
produce double backslashes, which only confuses people.
Diffstat (limited to 'coverage/execfile.py')
-rw-r--r-- | coverage/execfile.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/coverage/execfile.py b/coverage/execfile.py index 80277815..f46955bc 100644 --- a/coverage/execfile.py +++ b/coverage/execfile.py @@ -192,8 +192,8 @@ class PyRunner: except CoverageException: raise except Exception as exc: - msg = "Couldn't run '{filename}' as Python code: {exc.__class__.__name__}: {exc}" - raise CoverageException(msg.format(filename=self.arg0, exc=exc)) from exc + msg = f"Couldn't run '{self.arg0}' as Python code: {exc.__class__.__name__}: {exc}" + raise CoverageException(msg) from exc # Execute the code object. # Return to the original directory in case the test code exits in @@ -278,7 +278,7 @@ def make_code_from_py(filename): try: source = get_python_source(filename) except (OSError, NoSource) as exc: - raise NoSource(f"No file to run: {filename!r}") from exc + raise NoSource(f"No file to run: '{filename}'") from exc code = compile_unicode(source, filename, "exec") return code @@ -289,7 +289,7 @@ def make_code_from_pyc(filename): try: fpyc = open(filename, "rb") except OSError as exc: - raise NoCode(f"No file to run: {filename!r}") from exc + raise NoCode(f"No file to run: '{filename}'") from exc with fpyc: # First four bytes are a version-specific magic number. It has to |