[Libosinfo] [osinfo-db PATCH v2 3/7] tests: Add _SourceFiles() class
Fabiano Fidêncio
fidencio at redhat.com
Tue Apr 23 15:20:36 UTC 2019
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 at redhat.com>
---
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
More information about the Libosinfo
mailing list