summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_arcs.py44
-rw-r--r--tests/test_concurrency.py6
-rw-r--r--tests/test_config.py16
-rw-r--r--tests/test_data.py4
-rw-r--r--tests/test_files.py4
-rw-r--r--tests/test_numbits.py12
-rw-r--r--tests/test_oddball.py6
-rw-r--r--tests/test_parser.py2
-rw-r--r--tests/test_process.py31
-rw-r--r--tests/test_templite.py64
-rw-r--r--tests/test_testing.py17
11 files changed, 100 insertions, 106 deletions
diff --git a/tests/test_arcs.py b/tests/test_arcs.py
index 5b7965aa..6cdc908e 100644
--- a/tests/test_arcs.py
+++ b/tests/test_arcs.py
@@ -517,8 +517,8 @@ class LoopArcTest(CoverageTest):
branches_3([0,1])
""",
arcz=
- ".1 18 8G GH H. "
- ".2 23 34 43 26 3. 6. "
+ ".1 18 8G GH H. " +
+ ".2 23 34 43 26 3. 6. " +
"-89 9A 9-8 AB BC CB B9 AE E9",
arcz_missing="26 6."
)
@@ -1077,18 +1077,18 @@ class ExceptionArcTest(CoverageTest):
def test_except_jump_finally(self):
if env.PYBEHAVIOR.finally_jumps_back:
arcz = (
- ".1 1Q QR RS ST TU U. "
- ".2 23 34 45 56 4O 6L "
- "78 89 9A AL LA AO 8B BC CD DL LD D4 BE EF FG GL LG G. EH HI IJ JL HL "
- "L4 LM "
+ ".1 1Q QR RS ST TU U. " +
+ ".2 23 34 45 56 4O 6L " +
+ "78 89 9A AL LA AO 8B BC CD DL LD D4 BE EF FG GL LG G. EH HI IJ JL HL " +
+ "L4 LM " +
"MN NO O."
)
else:
arcz = (
- ".1 1Q QR RS ST TU U. "
- ".2 23 34 45 56 4O 6L "
- "78 89 9A AL 8B BC CD DL BE EF FG GL EH HI IJ JL HL "
- "LO L4 L. LM "
+ ".1 1Q QR RS ST TU U. " +
+ ".2 23 34 45 56 4O 6L " +
+ "78 89 9A AL 8B BC CD DL BE EF FG GL EH HI IJ JL HL " +
+ "LO L4 L. LM " +
"MN NO O."
)
self.check_coverage("""\
@@ -1131,18 +1131,18 @@ class ExceptionArcTest(CoverageTest):
def test_else_jump_finally(self):
if env.PYBEHAVIOR.finally_jumps_back:
arcz = (
- ".1 1S ST TU UV VW W. "
- ".2 23 34 45 56 6A 78 8N 4Q "
- "AB BC CN NC CQ AD DE EF FN NF F4 DG GH HI IN NI I. GJ JK KL LN JN "
- "N4 NO "
+ ".1 1S ST TU UV VW W. " +
+ ".2 23 34 45 56 6A 78 8N 4Q " +
+ "AB BC CN NC CQ AD DE EF FN NF F4 DG GH HI IN NI I. GJ JK KL LN JN " +
+ "N4 NO " +
"OP PQ Q."
)
else:
arcz = (
- ".1 1S ST TU UV VW W. "
- ".2 23 34 45 56 6A 78 8N 4Q "
- "AB BC CN AD DE EF FN DG GH HI IN GJ JK KL LN JN "
- "N4 NQ N. NO "
+ ".1 1S ST TU UV VW W. " +
+ ".2 23 34 45 56 6A 78 8N 4Q " +
+ "AB BC CN AD DE EF FN DG GH HI IN GJ JK KL LN JN " +
+ "N4 NQ N. NO " +
"OP PQ Q."
)
self.check_coverage("""\
@@ -1280,9 +1280,7 @@ class YieldTest(CoverageTest):
next(gen)
print(gen.send(6))
""",
- arcz=
- ".1 17 78 89 9A AB B. "
- ".2 23 34 45 52 2.",
+ arcz=".1 17 78 89 9A AB B. .2 23 34 45 52 2.",
arcz_missing="2.",
)
assert self.stdout() == "20\n12\n"
@@ -1850,8 +1848,8 @@ class AsyncTest(CoverageTest):
loop.close() # G
""",
arcz=
- ".1 13 38 8E EF FG G. "
- "-34 45 56 6-3 "
+ ".1 13 38 8E EF FG G. " +
+ "-34 45 56 6-3 " +
"-89 9C C-8",
arcz_unpredicted="5-3 9-8",
)
diff --git a/tests/test_concurrency.py b/tests/test_concurrency.py
index 0b8d6a8b..696b12eb 100644
--- a/tests/test_concurrency.py
+++ b/tests/test_concurrency.py
@@ -187,15 +187,13 @@ def cant_trace_msg(concurrency, the_module):
# We don't even have the underlying module installed, we expect
# coverage to alert us to this fact.
expected_out = (
- "Couldn't trace with concurrency=%s, "
- "the module isn't installed.\n" % concurrency
+ f"Couldn't trace with concurrency={concurrency}, the module isn't installed.\n"
)
elif env.C_TRACER or concurrency == "thread" or concurrency == "":
expected_out = None
else:
expected_out = (
- "Can't support concurrency=%s with PyTracer, "
- "only threads are supported\n" % concurrency
+ f"Can't support concurrency={concurrency} with PyTracer, only threads are supported\n"
)
return expected_out
diff --git a/tests/test_config.py b/tests/test_config.py
index 9e126827..aec18bf2 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -169,14 +169,14 @@ class ConfigTest(CoverageTest):
("timid = 1\n", r"no section headers"),
("[run\n", r"\[run"),
("[report]\nexclude_lines = foo(\n",
- r"Invalid \[report\].exclude_lines value 'foo\(': "
+ r"Invalid \[report\].exclude_lines value 'foo\(': " +
r"(unbalanced parenthesis|missing \))"),
("[report]\npartial_branches = foo[\n",
- r"Invalid \[report\].partial_branches value 'foo\[': "
+ r"Invalid \[report\].partial_branches value 'foo\[': " +
r"(unexpected end of regular expression|unterminated character set)"),
("[report]\npartial_branches_always = foo***\n",
- r"Invalid \[report\].partial_branches_always value "
- r"'foo\*\*\*': "
+ r"Invalid \[report\].partial_branches_always value " +
+ r"'foo\*\*\*': " +
r"multiple repeat"),
]
@@ -190,14 +190,14 @@ class ConfigTest(CoverageTest):
("[tool.coverage.run]\ntimid = \"maybe?\"\n", r"maybe[?]"),
("[tool.coverage.run\n", None),
('[tool.coverage.report]\nexclude_lines = ["foo("]\n',
- r"Invalid \[tool.coverage.report\].exclude_lines value u?'foo\(': "
+ r"Invalid \[tool.coverage.report\].exclude_lines value u?'foo\(': " +
r"(unbalanced parenthesis|missing \))"),
('[tool.coverage.report]\npartial_branches = ["foo["]\n',
- r"Invalid \[tool.coverage.report\].partial_branches value u?'foo\[': "
+ r"Invalid \[tool.coverage.report\].partial_branches value u?'foo\[': " +
r"(unexpected end of regular expression|unterminated character set)"),
('[tool.coverage.report]\npartial_branches_always = ["foo***"]\n',
- r"Invalid \[tool.coverage.report\].partial_branches_always value "
- r"u?'foo\*\*\*': "
+ r"Invalid \[tool.coverage.report\].partial_branches_always value " +
+ r"u?'foo\*\*\*': " +
r"multiple repeat"),
('[tool.coverage.run]\nconcurrency="foo"', "not a list"),
("[tool.coverage.report]\nprecision=1.23", "not an integer"),
diff --git a/tests/test_data.py b/tests/test_data.py
index 80cd9bc2..134eb55a 100644
--- a/tests/test_data.py
+++ b/tests/test_data.py
@@ -616,8 +616,8 @@ class CoverageDataFilesTest(DataTestHelpers, CoverageTest):
self.assert_line_counts(covdata2, SUMMARY_1)
assert re.search(
- r"^Erasing data file '.*\.coverage'\n"
- r"Creating data file '.*\.coverage'\n"
+ r"^Erasing data file '.*\.coverage'\n" +
+ r"Creating data file '.*\.coverage'\n" +
r"Opening data file '.*\.coverage'\n$",
debug.get_output()
)
diff --git a/tests/test_files.py b/tests/test_files.py
index d6005d36..e5dd83bd 100644
--- a/tests/test_files.py
+++ b/tests/test_files.py
@@ -93,8 +93,8 @@ def test_flat_rootname(original, flat):
@pytest.mark.parametrize(
- "patterns, case_insensitive, partial,"
- "matches,"
+ "patterns, case_insensitive, partial," +
+ "matches," +
"nomatches",
[
(
diff --git a/tests/test_numbits.py b/tests/test_numbits.py
index 3f69b4de..f7032de7 100644
--- a/tests/test_numbits.py
+++ b/tests/test_numbits.py
@@ -115,9 +115,9 @@ class NumbitsSqliteFunctionTest(CoverageTest):
def test_numbits_union(self):
res = self.cursor.execute(
- "select numbits_union("
- "(select numbits from data where id = 7),"
- "(select numbits from data where id = 9)"
+ "select numbits_union(" +
+ "(select numbits from data where id = 7)," +
+ "(select numbits from data where id = 9)" +
")"
)
expected = [
@@ -129,9 +129,9 @@ class NumbitsSqliteFunctionTest(CoverageTest):
def test_numbits_intersection(self):
res = self.cursor.execute(
- "select numbits_intersection("
- "(select numbits from data where id = 7),"
- "(select numbits from data where id = 9)"
+ "select numbits_intersection(" +
+ "(select numbits from data where id = 7)," +
+ "(select numbits from data where id = 9)" +
")"
)
answer = numbits_to_nums(list(res)[0][0])
diff --git a/tests/test_oddball.py b/tests/test_oddball.py
index a97fc190..c3082abb 100644
--- a/tests/test_oddball.py
+++ b/tests/test_oddball.py
@@ -484,9 +484,9 @@ class GettraceTest(CoverageTest):
out = self.stdout().replace(self.last_module_name, "coverage_test")
expected = (
- "call: coverage_test.py @ 12\n"
- "line: coverage_test.py @ 13\n"
- "line: coverage_test.py @ 14\n"
+ "call: coverage_test.py @ 12\n" +
+ "line: coverage_test.py @ 13\n" +
+ "line: coverage_test.py @ 14\n" +
"return: coverage_test.py @ 14\n"
)
assert expected == out
diff --git a/tests/test_parser.py b/tests/test_parser.py
index 1b4e8aca..82bf7616 100644
--- a/tests/test_parser.py
+++ b/tests/test_parser.py
@@ -120,7 +120,7 @@ class PythonParserTest(CoverageTest):
def test_indentation_error(self):
msg = (
- "Couldn't parse '<code>' as Python source: "
+ "Couldn't parse '<code>' as Python source: " +
"'unindent does not match any outer indentation level' at line 3"
)
with pytest.raises(NotPython, match=msg):
diff --git a/tests/test_process.py b/tests/test_process.py
index c41c57b7..1adb6cff 100644
--- a/tests/test_process.py
+++ b/tests/test_process.py
@@ -130,7 +130,7 @@ class ProcessTest(CoverageTest):
self.assert_exists(".coverage")
self.assert_exists(".coverage.bad")
warning_regex = (
- r"CoverageWarning: Couldn't use data file '.*\.coverage\.bad': "
+ r"CoverageWarning: Couldn't use data file '.*\.coverage\.bad': " +
r"file (is encrypted or )?is not a database"
)
assert re.search(warning_regex, out)
@@ -163,9 +163,8 @@ class ProcessTest(CoverageTest):
for n in "12":
self.assert_exists(f".coverage.bad{n}")
warning_regex = (
- r"CoverageWarning: Couldn't use data file '.*\.coverage.bad{}': "
+ fr"CoverageWarning: Couldn't use data file '.*\.coverage.bad{n}': " +
r"file (is encrypted or )?is not a database"
- .format(n)
)
assert re.search(warning_regex, out)
assert re.search(r"No usable data files", out)
@@ -725,9 +724,9 @@ class ProcessTest(CoverageTest):
assert "Goodbye!" in out
msg = (
- "CoverageWarning: "
- "Already imported a file that will be measured: {} "
- "(already-imported)").format(goodbye_path)
+ f"CoverageWarning: Already imported a file that will be measured: {goodbye_path} " +
+ "(already-imported)"
+ )
assert msg in out
@pytest.mark.expensive
@@ -1313,10 +1312,10 @@ class UnicodeFilePathsTest(CoverageTest):
assert ' name="h\xe2t.py"'.encode() in xml
report_expected = (
- "Name Stmts Miss Cover\n"
- "----------------------------\n"
- "h\xe2t.py 1 0 100%\n"
- "----------------------------\n"
+ "Name Stmts Miss Cover\n" +
+ "----------------------------\n" +
+ "h\xe2t.py 1 0 100%\n" +
+ "----------------------------\n" +
"TOTAL 1 0 100%\n"
)
@@ -1357,12 +1356,12 @@ class UnicodeFilePathsTest(CoverageTest):
}
report_expected = (
- "Name Stmts Miss Cover\n"
- "-----------------------------------\n"
- "\xe2%saccented.py 1 0 100%%\n"
- "-----------------------------------\n"
- "TOTAL 1 0 100%%\n"
- ) % os.sep
+ "Name Stmts Miss Cover\n" +
+ "-----------------------------------\n" +
+ f"\xe2{os.sep}accented.py 1 0 100%\n" +
+ "-----------------------------------\n" +
+ "TOTAL 1 0 100%\n"
+ )
out = self.run_command("coverage report")
assert out == report_expected
diff --git a/tests/test_templite.py b/tests/test_templite.py
index e4d83647..0f86690b 100644
--- a/tests/test_templite.py
+++ b/tests/test_templite.py
@@ -148,7 +148,7 @@ class TempliteTest(CoverageTest):
def test_multiple_loops(self):
self.try_render(
- "{% for n in nums %}{{n}}{% endfor %} and "
+ "{% for n in nums %}{{n}}{% endfor %} and " +
"{% for n in nums %}{{n}}{% endfor %}",
{'nums': [1,2,3]},
"123 and 123"
@@ -201,10 +201,10 @@ class TempliteTest(CoverageTest):
return self.it
obj = Complex(it={'x':"Hello", 'y': 0})
self.try_render(
- "@"
- "{% if obj.getit.x %}X{% endif %}"
- "{% if obj.getit.y %}Y{% endif %}"
- "{% if obj.getit.y|str %}S{% endif %}"
+ "@" +
+ "{% if obj.getit.x %}X{% endif %}" +
+ "{% if obj.getit.y %}Y{% endif %}" +
+ "{% if obj.getit.y|str %}S{% endif %}" +
"!",
{ 'obj': obj, 'str': str },
"@XS!"
@@ -229,10 +229,10 @@ class TempliteTest(CoverageTest):
def test_nested_loops(self):
self.try_render(
- "@"
- "{% for n in nums %}"
- "{% for a in abc %}{{a}}{{n}}{% endfor %}"
- "{% endfor %}"
+ "@" +
+ "{% for n in nums %}" +
+ "{% for a in abc %}{{a}}{{n}}{% endfor %}" +
+ "{% endfor %}" +
"!",
{'nums': [0,1,2], 'abc': ['a', 'b', 'c']},
"@a0b0c0a1b1c1a2b2c2!"
@@ -240,28 +240,28 @@ class TempliteTest(CoverageTest):
def test_whitespace_handling(self):
self.try_render(
- "@{% for n in nums %}\n"
- " {% for a in abc %}{{a}}{{n}}{% endfor %}\n"
+ "@{% for n in nums %}\n" +
+ " {% for a in abc %}{{a}}{{n}}{% endfor %}\n" +
"{% endfor %}!\n",
{'nums': [0, 1, 2], 'abc': ['a', 'b', 'c']},
"@\n a0b0c0\n\n a1b1c1\n\n a2b2c2\n!\n"
)
self.try_render(
- "@{% for n in nums -%}\n"
- " {% for a in abc -%}\n"
- " {# this disappears completely -#}\n"
- " {{a-}}\n"
- " {{n -}}\n"
- " {{n -}}\n"
- " {% endfor %}\n"
+ "@{% for n in nums -%}\n" +
+ " {% for a in abc -%}\n" +
+ " {# this disappears completely -#}\n" +
+ " {{a-}}\n" +
+ " {{n -}}\n" +
+ " {{n -}}\n" +
+ " {% endfor %}\n" +
"{% endfor %}!\n",
{'nums': [0, 1, 2], 'abc': ['a', 'b', 'c']},
"@a00b00c00\na11b11c11\na22b22c22\n!\n"
)
self.try_render(
- "@{% for n in nums -%}\n"
- " {{n -}}\n"
- " x\n"
+ "@{% for n in nums -%}\n" +
+ " {{n -}}\n" +
+ " x\n" +
"{% endfor %}!\n",
{'nums': [0, 1, 2]},
"@0x\n1x\n2x\n!\n"
@@ -270,17 +270,17 @@ class TempliteTest(CoverageTest):
def test_eat_whitespace(self):
self.try_render(
- "Hey!\n"
- "{% joined %}\n"
- "@{% for n in nums %}\n"
- " {% for a in abc %}\n"
- " {# this disappears completely #}\n"
- " X\n"
- " Y\n"
- " {{a}}\n"
- " {{n }}\n"
- " {% endfor %}\n"
- "{% endfor %}!\n"
+ "Hey!\n" +
+ "{% joined %}\n" +
+ "@{% for n in nums %}\n" +
+ " {% for a in abc %}\n" +
+ " {# this disappears completely #}\n" +
+ " X\n" +
+ " Y\n" +
+ " {{a}}\n" +
+ " {{n }}\n" +
+ " {% endfor %}\n" +
+ "{% endfor %}!\n" +
"{% endjoined %}\n",
{'nums': [0, 1, 2], 'abc': ['a', 'b', 'c']},
"Hey!\n@XYa0XYb0XYc0XYa1XYb1XYc1XYa2XYb2XYc2!\n"
diff --git a/tests/test_testing.py b/tests/test_testing.py
index 4699799e..eae18890 100644
--- a/tests/test_testing.py
+++ b/tests/test_testing.py
@@ -61,20 +61,19 @@ class CoverageTestTest(CoverageTest):
self.assert_file_count("afile.*", 1)
self.assert_file_count("*.q", 0)
msg = re.escape(
- "There should be 13 files matching 'a*.txt', but there are these: "
+ "There should be 13 files matching 'a*.txt', but there are these: " +
"['abcde.txt', 'afile.txt', 'axczz.txt']"
)
with pytest.raises(AssertionError, match=msg):
self.assert_file_count("a*.txt", 13)
msg = re.escape(
- "There should be 12 files matching '*c*.txt', but there are these: "
+ "There should be 12 files matching '*c*.txt', but there are these: " +
"['abcde.txt', 'axczz.txt']"
)
with pytest.raises(AssertionError, match=msg):
self.assert_file_count("*c*.txt", 12)
msg = re.escape(
- "There should be 11 files matching 'afile.*', but there are these: "
- "['afile.txt']"
+ "There should be 11 files matching 'afile.*', but there are these: ['afile.txt']"
)
with pytest.raises(AssertionError, match=msg):
self.assert_file_count("afile.*", 11)
@@ -374,11 +373,11 @@ class ArczTest(CoverageTest):
([(-1, 1), (1, 2), (2, -5)], "(-1, 1) # .1\n(1, 2) # 12\n(2, -5) # 2-5\n"),
([(-26, 10), (12, 11), (18, 29), (35, -10), (1, 33), (100, 7)],
(
- "(-26, 10) # -QA\n"
- "(12, 11) # CB\n"
- "(18, 29) # IT\n"
- "(35, -10) # Z-A\n"
- "(1, 33) # 1X\n"
+ "(-26, 10) # -QA\n" +
+ "(12, 11) # CB\n" +
+ "(18, 29) # IT\n" +
+ "(35, -10) # Z-A\n" +
+ "(1, 33) # 1X\n" +
"(100, 7) # ?7\n"
)
),