diff --git a/.github/workflows/c-cpp-cmake.yml b/.github/workflows/c-cpp-cmake.yml index 7c76128..cb577c2 100644 --- a/.github/workflows/c-cpp-cmake.yml +++ b/.github/workflows/c-cpp-cmake.yml @@ -58,6 +58,7 @@ jobs: dir cmake --build . cd .. + set "PATH=%PATH%;c:/vcpkg/installed/x64-windows/bin" python tests\run.py || exit /b 1 rmdir /s /q build diff --git a/tests/harness.py b/tests/harness.py index a0eabf7..ad80f2e 100644 --- a/tests/harness.py +++ b/tests/harness.py @@ -419,15 +419,24 @@ class Tester: return self._record(unexpected != actual, label, f"anything but {unexpected!r}", actual) + @staticmethod + def _as_text(value): + """A reply that never arrived has no text, so report the reason.""" + if isinstance(value, Response): + if value.error: + return f"" + if not value.body and value.status is not None: + return f"<{value.status}, empty body>" + return value.text + return value + def contains(self, haystack, needle, label): - if isinstance(haystack, Response): - haystack = haystack.text + haystack = self._as_text(haystack) return self._record(needle in haystack, label, f"text containing {needle!r}", self._clip(haystack)) def not_contains(self, haystack, needle, label): - if isinstance(haystack, Response): - haystack = haystack.text + haystack = self._as_text(haystack) return self._record(needle not in haystack, label, f"text without {needle!r}", self._clip(haystack))