From 001f6532f8a8bf05f1cf6f2b5574ba091550a77d Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Wed, 13 Oct 2021 06:47:57 -0400 Subject: test: don't use subprocesses where we don't have to When running tests with `-n 0`, this shaves 4 seconds off the run time. When running the complete test suite with xdist, it takes 2 seconds longer!? --- tests/test_arcs.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'tests/test_arcs.py') diff --git a/tests/test_arcs.py b/tests/test_arcs.py index 6cdc908e..1284badc 100644 --- a/tests/test_arcs.py +++ b/tests/test_arcs.py @@ -462,8 +462,9 @@ class LoopArcTest(CoverageTest): while True: return 1 """) - out = self.run_command("coverage run --branch --source=. main.py") - assert out == 'done\n' + cov = coverage.Coverage(source=["."], branch=True) + self.start_import_stop(cov, "main") + assert self.stdout() == 'done\n' if env.PYBEHAVIOR.keep_constant_test: num_stmts = 3 elif env.PYBEHAVIOR.nix_while_true: @@ -471,7 +472,7 @@ class LoopArcTest(CoverageTest): else: num_stmts = 3 expected = "zero.py {n} {n} 0 0 0% 1-3".format(n=num_stmts) - report = self.report_from_command("coverage report -m") + report = self.get_report(cov, show_missing=True) squeezed = self.squeezed_lines(report) assert expected in squeezed[3] -- cgit v1.2.1