[Libosinfo] [PATCH osinfo-db 07/15] tests: test_resources: consolidate to one test case

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


These are essentially all very quick 'resources' validation checks.
I don't think there's much benefit in keeping them as separate top
level test cases, and it adds extraneous pytest report output

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

diff --git a/tests/test_resources.py b/tests/test_resources.py
index 01b0ef7..a57991c 100644
--- a/tests/test_resources.py
+++ b/tests/test_resources.py
@@ -8,9 +8,9 @@ import logging
 from . import util
 
 
- at util.os_parametrize('osxml', filter_resources=True)
-def test_resources_uniqueness_by_arch(osxml):
-    """ Ensure there's no more than one resource element per architecture """
+def _test_resources_uniqueness_by_arch(osxml):
+    """Ensure there's no more than one resource element per architecture
+    """
     result = defaultdict(list)
     for resources in osxml.resources_list:
         result[resources.get('arch')].append(resources)
@@ -20,46 +20,31 @@ def test_resources_uniqueness_by_arch(osxml):
 
 
 @util.os_parametrize('osxml', filter_resources=True)
-def test_minimum_recommended_resources(osxml):
-    """ Ensure there's no minimum resources with bigger values than recommended
-        resources
-    """
+def test_resources(osxml):
+    _test_resources_uniqueness_by_arch(osxml)
+
+    # Ensure minimum resources are <= recommended resources
     _resources_helper(osxml,
                       osxml.get_minimum_resources,
                       'minimum',
                       osxml.get_recommended_resources,
                       'recommended')
 
-
- at util.os_parametrize('osxml', filter_resources=True)
-def test_recommended_maximum_resources(osxml):
-    """ Ensure there's no recommended resources with bigger values than maximum
-        resources
-    """
+    # Ensure recommended resources are <= maximum resources
     _resources_helper(osxml,
                       osxml.get_recommended_resources,
                       'recommended',
                       osxml.get_maximum_resources,
                       'maximum')
 
-
- at util.os_parametrize('osxml', filter_resources=True)
-def test_recommended_network_install_resources(osxml):
-    """ Ensure there's no recommended resources with bigger values than
-        network-install resources
-    """
+    # Ensure recommended resources <= network resources
     _resources_helper(osxml,
                       osxml.get_recommended_resources,
                       'recommended',
                       osxml.get_network_install_resources,
                       'network-install')
 
-
- at util.os_parametrize('osxml', filter_resources=True)
-def test_network_install_maximum_resources(osxml):
-    """ Ensure there's no network-install resources with bigger values than
-        maximum resources
-    """
+    # Ensure network resources <= maximum resources
     _resources_helper(osxml,
                       osxml.get_network_install_resources,
                       'network-install',
-- 
2.21.0




More information about the Libosinfo mailing list