[elbe-devel] [PATCH 3/6] elbepack: test_doctest: migrate to subtests
Thomas Weißschuh
thomas.weissschuh at linutronix.de
Tue Mar 5 16:36:10 CET 2024
The custom test-parameterization is not compatible with pytest.
As pytest is more featureful than our own test runner prepare for
switching over.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
elbepack/tests/test_doctest.py | 25 ++++++-------------------
1 file changed, 6 insertions(+), 19 deletions(-)
diff --git a/elbepack/tests/test_doctest.py b/elbepack/tests/test_doctest.py
index 3694bca583bd..15b53778c1d4 100644
--- a/elbepack/tests/test_doctest.py
+++ b/elbepack/tests/test_doctest.py
@@ -10,24 +10,11 @@ from elbepack.commands.test import ElbeTestCase
class ElbeDocTest(ElbeTestCase):
+ def test_shellhelper(self):
+ fail, _ = doctest.testmod(shellhelper)
+ self.assertEqual(fail, 0)
- # This is an example of a callable parametrization
- @staticmethod
- def params():
- return [shellhelper, filesystem]
-
- def setUp(self):
-
- self.kwargs = {}
-
- if self.param is filesystem:
- self.kwargs['extraglobs'] = {'this': filesystem.TmpdirFilesystem()}
-
- def tearDown(self):
-
- if self.param is filesystem:
- self.kwargs['extraglobs']['this'].delete()
-
- def test_doctest(self):
- fail, _ = doctest.testmod(self.param, **self.kwargs)
+ def test_filesystem(self):
+ with filesystem.TmpdirFilesystem() as this:
+ fail, _ = doctest.testmod(filesystem, extraglobs={'this': this})
self.assertEqual(fail, 0)
--
2.44.0
More information about the elbe-devel
mailing list