[Libosinfo] [osinfo-db PATCH v2 4/7] tests: Move _check_uncommended_devices() to its own test

Fabiano Fidêncio fidencio at redhat.com
Tue Apr 23 15:20:37 UTC 2019


This has to be done as this test should run against the source files and
not against the generated ones.

This is part of the changes needed in order to provide a fix for
out-of-tree `make check` run.

Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
---
 tests/test_devices.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/tests/test_devices.py b/tests/test_devices.py
index 7cecadc..37b1618 100644
--- a/tests/test_devices.py
+++ b/tests/test_devices.py
@@ -7,6 +7,7 @@ from . import util
 
 
 DEVICE_MAP = {d.internal_id: d for d in util.DataFiles.devices()}
+DEVICE_MAP_SRC = {d.internal_id: d for d in util.SourceFiles.devices()}
 
 
 def _check_duplicate_devices(osxml):
@@ -29,12 +30,11 @@ def _check_uncommented_devices(osxml):
     the device string name in it. This helps readability/grepability
     """
     badlines = []
-    sourcefile = osxml.filename + ".in"
-    devlines = [l for l in open(sourcefile).read().splitlines() if
+    devlines = [l for l in open(osxml.filename).read().splitlines() if
                 "<device id" in l]
 
     for devid in osxml.devices:
-        devname = DEVICE_MAP[devid].name
+        devname = DEVICE_MAP_SRC[devid].name
         for devline in devlines:
             if devid not in devline:
                 continue
@@ -50,4 +50,8 @@ def _check_uncommented_devices(osxml):
 @util.os_parametrize('osxml', filter_devices=True)
 def test_devices_duplication(osxml):
     _check_duplicate_devices(osxml)
+
+
+ at util.os_sources_parametrize('osxml', filter_devices=True)
+def test_devices_comments(osxml):
     _check_uncommented_devices(osxml)
-- 
2.21.0




More information about the Libosinfo mailing list