Skip to content

Commit 2afc907

Browse files
committed
refactor(test): convert eight tests to one parametrized test
1 parent 2a2293c commit 2afc907

File tree

1 file changed

+4
-27
lines changed

1 file changed

+4
-27
lines changed

tests/test_process.py

+4-27
Original file line numberDiff line numberDiff line change
@@ -1574,9 +1574,10 @@ class ProcessStartupWithSourceTest(ProcessCoverageMixin, CoverageTest):
15741574
15751575
"""
15761576

1577-
def assert_pth_and_source_work_together(
1578-
self, dashm, package, source
1579-
):
1577+
@pytest.mark.parametrize("dashm", ["-m", ""])
1578+
@pytest.mark.parametrize("package", ["pkg", ""])
1579+
@pytest.mark.parametrize("source", ["main", "sub"])
1580+
def test_pth_and_source_work_together(self, dashm, package, source):
15801581
"""Run the test for a particular combination of factors.
15811582
15821583
The arguments are all strings:
@@ -1641,27 +1642,3 @@ def path(basename):
16411642
summary = line_counts(data)
16421643
assert summary[source + '.py'] == 3
16431644
assert len(summary) == 1
1644-
1645-
def test_dashm_main(self):
1646-
self.assert_pth_and_source_work_together('-m', '', 'main')
1647-
1648-
def test_script_main(self):
1649-
self.assert_pth_and_source_work_together('', '', 'main')
1650-
1651-
def test_dashm_sub(self):
1652-
self.assert_pth_and_source_work_together('-m', '', 'sub')
1653-
1654-
def test_script_sub(self):
1655-
self.assert_pth_and_source_work_together('', '', 'sub')
1656-
1657-
def test_dashm_pkg_main(self):
1658-
self.assert_pth_and_source_work_together('-m', 'pkg', 'main')
1659-
1660-
def test_script_pkg_main(self):
1661-
self.assert_pth_and_source_work_together('', 'pkg', 'main')
1662-
1663-
def test_dashm_pkg_sub(self):
1664-
self.assert_pth_and_source_work_together('-m', 'pkg', 'sub')
1665-
1666-
def test_script_pkg_sub(self):
1667-
self.assert_pth_and_source_work_together('', 'pkg', 'sub')

0 commit comments

Comments
 (0)