[osinfo-db PATCH v2 3/7] tests: Add _SourceFiles() class

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This class tracks a list of the *source* XML files and provide APIs for
querying them, in the very same way done for the _DataFiles() class.

Signed-off-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx>
---
 tests/util.py | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/tests/util.py b/tests/util.py
index 2a44b8a..f60ef9b 100644
--- a/tests/util.py
+++ b/tests/util.py
@@ -148,3 +148,25 @@ def os_parametrize(argname, **kwargs):
     """
     oses = DataFiles.oses(**kwargs)
     return pytest.mark.parametrize(argname, oses, ids=_ids_cb)
+
+
+class _SourceFiles(_Files):
+    """
+    Track a list of DATA_SRC_DIR XML.IN files and provide APIs for querying
+    them. Meant to be initialized only once
+    """
+    def __init__(self):
+        _Files.__init__(self, 'INTERNAL_OSINFO_DB_DATA_SRC_DIR', '.xml.in')
+
+
+SourceFiles = _SourceFiles()
+
+
+def os_sources_parametrize(argname, **kwargs):
+    """
+    Helper for parametrizing a test with an OS list. Passthrough any
+    extra arguments to DataFiles.oses()
+    """
+
+    oses = SourceFiles.oses(**kwargs)
+    return pytest.mark.parametrize(argname, oses, ids=_ids_cb)
-- 
2.21.0

_______________________________________________
Libosinfo mailing list
Libosinfo@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libosinfo




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux