From e167da97d0bb41d2e65e861e8d5dd6cdfa7bb207 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Sun, 14 Jun 2026 20:24:27 +0200 Subject: [PATCH] feat(pytest): clear "pytest not installed" message When collection finds nothing because pytest is missing on the host interpreter, load() raises a dedicated message ("pytest is not installed ... pip install pytest") instead of the raw pytest output. The graceful load mechanism surfaces it as a WARN at load + a clean FAIL at run, the rest of the campaign keeps running. Co-Authored-By: Claude Opus 4.8 --- src/testium/interpreter/test_items/test_item_pytest.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/testium/interpreter/test_items/test_item_pytest.py b/src/testium/interpreter/test_items/test_item_pytest.py index 695fef9..11af6c6 100644 --- a/src/testium/interpreter/test_items/test_item_pytest.py +++ b/src/testium/interpreter/test_items/test_item_pytest.py @@ -231,6 +231,13 @@ class TestItemPytestFile(TestItem): proc.wait() return nodeids, "\n".join(output) + def _collection_error(self, output): + """Clear reason why collection produced no test.""" + if "No module named pytest" in output: + return ("pytest is not installed on the host interpreter used by " + "testium (python_bin). Install it, e.g. 'pip install pytest'.") + return 'No pytest test collected from "%s".\n%s' % (self._fileName, output) + def load(self): ret = {} if self._fileName == '': @@ -246,8 +253,7 @@ class TestItemPytestFile(TestItem): nodeids, output = self._collect() if not nodeids: - raise ETUMFileError( - 'No pytest test collected from "%s".\n%s' % (self._fileName, output)) + raise ETUMFileError(self._collection_error(output)) if self._test_methods: present = {nid.split("::")[-1].split("[")[0] for nid in nodeids}