Skip to content

Commit 8ca306e

Browse files
committed
test(perf): shave a few seconds off the FailUnder tests
1 parent c9d821d commit 8ca306e

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

tests/test_process.py

+9-12
Original file line numberDiff line numberDiff line change
@@ -1245,8 +1245,7 @@ def setUp(self):
12451245
d = 6
12461246
e = 7
12471247
""")
1248-
st, _ = self.run_command_status("coverage run --source=. forty_two_plus.py")
1249-
assert st == 0
1248+
self.make_data_file(lines={abs_file("forty_two_plus.py"): [2, 3, 4]})
12501249

12511250
def test_report_43_is_ok(self):
12521251
st, out = self.run_command_status("coverage report --fail-under=43")
@@ -1267,16 +1266,14 @@ def test_report_42p86_is_not_ok(self):
12671266
assert expected == self.last_line_squeezed(out)
12681267

12691268
def test_report_99p9_is_not_ok(self):
1270-
# A file with 99.99% coverage:
1271-
self.make_file("ninety_nine_plus.py", """\
1272-
a = 1
1273-
""" + """
1274-
b = 2
1275-
""" * 20000 + """
1276-
if a > 3:
1277-
c = 4
1278-
""")
1279-
self.run_command("coverage run --source=. ninety_nine_plus.py")
1269+
# A file with 99.9% coverage:
1270+
self.make_file("ninety_nine_plus.py",
1271+
"a = 1\n" +
1272+
"b = 2\n" * 2000 +
1273+
"if a > 3:\n" +
1274+
" c = 4\n"
1275+
)
1276+
self.make_data_file(lines={abs_file("ninety_nine_plus.py"): range(1, 2002)})
12801277
st, out = self.run_command_status("coverage report --fail-under=100")
12811278
assert st == 2
12821279
expected = "Coverage failure: total of 99 is less than fail-under=100"

0 commit comments

Comments
 (0)