summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2021-11-07 18:22:06 -0500
committerNed Batchelder <ned@nedbatchelder.com>2021-11-07 18:22:06 -0500
commit2afc907abac4fe413ac53e6854d433e1c03bf720 (patch)
tree1f14b47c0fbae79863294b3eebdfd3633b9aae7d
parent2a2293cafb6b322eb3329b5a7abd98435c56f361 (diff)
downloadpython-coveragepy-git-2afc907abac4fe413ac53e6854d433e1c03bf720.tar.gz
refactor(test): convert eight tests to one parametrized test
-rw-r--r--tests/test_process.py31
1 files changed, 4 insertions, 27 deletions
diff --git a/tests/test_process.py b/tests/test_process.py
index b6c09f66..1e644864 100644
--- a/tests/test_process.py
+++ b/tests/test_process.py
@@ -1574,9 +1574,10 @@ class ProcessStartupWithSourceTest(ProcessCoverageMixin, CoverageTest):
"""
- def assert_pth_and_source_work_together(
- self, dashm, package, source
- ):
+ @pytest.mark.parametrize("dashm", ["-m", ""])
+ @pytest.mark.parametrize("package", ["pkg", ""])
+ @pytest.mark.parametrize("source", ["main", "sub"])
+ def test_pth_and_source_work_together(self, dashm, package, source):
"""Run the test for a particular combination of factors.
The arguments are all strings:
@@ -1641,27 +1642,3 @@ class ProcessStartupWithSourceTest(ProcessCoverageMixin, CoverageTest):
summary = line_counts(data)
assert summary[source + '.py'] == 3
assert len(summary) == 1
-
- def test_dashm_main(self):
- self.assert_pth_and_source_work_together('-m', '', 'main')
-
- def test_script_main(self):
- self.assert_pth_and_source_work_together('', '', 'main')
-
- def test_dashm_sub(self):
- self.assert_pth_and_source_work_together('-m', '', 'sub')
-
- def test_script_sub(self):
- self.assert_pth_and_source_work_together('', '', 'sub')
-
- def test_dashm_pkg_main(self):
- self.assert_pth_and_source_work_together('-m', 'pkg', 'main')
-
- def test_script_pkg_main(self):
- self.assert_pth_and_source_work_together('', 'pkg', 'main')
-
- def test_dashm_pkg_sub(self):
- self.assert_pth_and_source_work_together('-m', 'pkg', 'sub')
-
- def test_script_pkg_sub(self):
- self.assert_pth_and_source_work_together('', 'pkg', 'sub')