[Libosinfo] [PATCH osinfo-db 13/15] tests: test_isoinfo: improve output on failure

Cole Robinson crobinso at redhat.com
Mon Mar 25 14:32:17 UTC 2019


This makes it easier to see exactly what test failed, and how

Signed-off-by: Cole Robinson <crobinso at redhat.com>
---
 tests/test_isoinfo.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tests/test_isoinfo.py b/tests/test_isoinfo.py
index 8809126..f5a15ba 100644
--- a/tests/test_isoinfo.py
+++ b/tests/test_isoinfo.py
@@ -55,11 +55,11 @@ def test_iso_detection(testdata):
                     if osxml2.shortid not in detected:
                         detected.append(osxml2.shortid)
 
-        if len(detected) != 1:
-            logging.warning('Some ISOs have been matched several times by '
-                            'the different OSes, which indicates an issue '
-                            'in the DB entries.')
-        assert len(detected) == 1
+        if detected == [osname]:
+            continue
+
+        raise AssertionError("isodata: %s\nMatched=%s but expected=%s" %
+                (isodatapath, detected, [osname]))
 
 
 class _ISODataMedia():
-- 
2.21.0




More information about the Libosinfo mailing list