]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
tests: Add back isinstance() check to pytest_assertrepr_compare()
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 7 Apr 2022 08:48:25 +0000 (10:48 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 14 Apr 2022 20:35:40 +0000 (22:35 +0200)
Turns out that the added typing was wrong, not the isinstance()
check so add back the isinstance() check and change the type to Any
instead.

tests/conftest.py

index 2719333c369c4181fc8707dd17f92b6f5a22ca27..662acdd777d89c8acea569a339ace8ec3b644a10 100644 (file)
@@ -30,7 +30,9 @@ class DictDiffer:
         return {o for o in self.intersect if self.expected_dict[o] == self.current_dict[o]}
 
 
-def pytest_assertrepr_compare(op: str, left: MkosiConfig, right: Dict[str, Any]) -> List[str]:
+def pytest_assertrepr_compare(op: str, left: MkosiConfig, right: Any) -> List[str]:
+    if not isinstance(right, dict):
+        return []
     for r in right.values():
         if not isinstance(vars(r), dict):
             return ["Invalid datatype"]