summaryrefslogtreecommitdiff
path: root/coverage/misc.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2019-06-11 10:06:35 -0400
committerNed Batchelder <ned@nedbatchelder.com>2019-06-11 10:06:35 -0400
commitf31295ef30be63ab48766958320207af1f6dde5d (patch)
tree5a76d36b24d10532c066d4f6d297d1776ec8c1ee /coverage/misc.py
parent4f6365167a0921335e1e365a3cff05a5907943dd (diff)
downloadpython-coveragepy-git-f31295ef30be63ab48766958320207af1f6dde5d.tar.gz
Polishing substitute_variables
Diffstat (limited to 'coverage/misc.py')
-rw-r--r--coverage/misc.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/coverage/misc.py b/coverage/misc.py
index e34bc000..d87a7b89 100644
--- a/coverage/misc.py
+++ b/coverage/misc.py
@@ -260,7 +260,7 @@ def substitute_variables(text, variables=os.environ):
strict = bool(m.group('strict'))
if strict:
if word not in variables:
- msg = "Variable {} is undefined: {}".format(word, text)
+ msg = "Variable {} is undefined: {!r}".format(word, text)
raise CoverageException(msg)
return variables.get(word, m.group('defval') or '')
@@ -271,8 +271,7 @@ def substitute_variables(text, variables=os.environ):
{ # or a {-wrapped word,
(?P<v2>\w+)
(?:
- (?P<strict>\?) # with a strict marker
- |
+ (?P<strict>\?) | # with a strict marker
-(?P<defval>[^}]*) # or a default value
)?
}