diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2021-10-10 12:16:02 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2021-10-10 12:16:02 -0400 |
commit | 4144f9595595f0aff458c3da5c70ff6fe8de570e (patch) | |
tree | e23422851ee3f0564b43ac3e2763805cf67f671d | |
parent | 6c5ef77a267e244f4e50a161bd6bcf09831de943 (diff) | |
download | python-coveragepy-git-4144f9595595f0aff458c3da5c70ff6fe8de570e.tar.gz |
refactor: simplify some strange string formatting
-rw-r--r-- | tests/test_data.py | 6 | ||||
-rw-r--r-- | tests/test_process.py | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/tests/test_data.py b/tests/test_data.py index 3adba5f0..0660591f 100644 --- a/tests/test_data.py +++ b/tests/test_data.py @@ -584,7 +584,7 @@ class CoverageDataInTempDirTest(CoverageTest): assert_arcs3_data(covdata2) def test_read_errors(self): - msg = r"Couldn't .* '.*[/\\]{0}': \S+" + msg = r"Couldn't .* '.*[/\\]{}': \S+" self.make_file("xyzzy.dat", "xyzzy") with pytest.raises(CoverageException, match=msg.format("xyzzy.dat")): @@ -602,7 +602,7 @@ class CoverageDataInTempDirTest(CoverageTest): with sqlite3.connect("wrong_schema.db") as con: con.execute("create table coverage_schema (version integer)") con.execute("insert into coverage_schema (version) values (99)") - msg = r"Couldn't .* '.*[/\\]{}': wrong schema: 99 instead of \d+".format("wrong_schema.db") + msg = r"Couldn't .* '.*[/\\]wrong_schema.db': wrong schema: 99 instead of \d+" with pytest.raises(CoverageException, match=msg): covdata = DebugCoverageData("wrong_schema.db") covdata.read() @@ -610,7 +610,7 @@ class CoverageDataInTempDirTest(CoverageTest): with sqlite3.connect("no_schema.db") as con: con.execute("create table foobar (baz text)") - msg = r"Couldn't .* '.*[/\\]{}': \S+".format("no_schema.db") + msg = r"Couldn't .* '.*[/\\]no_schema.db': \S+" with pytest.raises(CoverageException, match=msg): covdata = DebugCoverageData("no_schema.db") covdata.read() diff --git a/tests/test_process.py b/tests/test_process.py index 6c5dd76b..d5c322fc 100644 --- a/tests/test_process.py +++ b/tests/test_process.py @@ -1654,9 +1654,9 @@ def run_in_venv(cmd): """ words = cmd.split() if env.WINDOWS: - words[0] = r"{}\Scripts\{}.exe".format("venv", words[0]) + words[0] = fr"venv\Scripts\{words[0]}.exe" else: - words[0] = "{}/bin/{}".format("venv", words[0]) + words[0] = fr"venv/bin/{words[0]}" status, output = run_command(" ".join(words)) assert status == 0 return output |