[VVP] udpating scripts for casablanca
[vvp/validation-scripts.git] / ice_validator / tests / parametrizers.py
index dcfe402..641d53a 100644 (file)
@@ -43,7 +43,7 @@
 
 from os import path, listdir
 import re
-import yaml
+from tests import cached_yaml as yaml
 import pytest
 from .helpers import get_parsed_yml_for_yaml_files, check_basename_ending
 from .utils.nested_files import get_list_of_nested_files
@@ -80,19 +80,18 @@ def get_nested_files(filenames):
             if "resources" not in yml:
                 continue
             nested_files.extend(get_list_of_nested_files(
-                    yml["resources"],
-                    path.dirname(filename)))
+                yml["resources"],
+                path.dirname(filename)))
         except yaml.YAMLError as e:
             print(e)  # pylint: disable=superfluous-parens
             continue
     return nested_files
 
 
-def list_filenames_in_template_dir(
-            metafunc,
-            extensions,
-            template_type='',
-            sub_dirs=None):
+def list_filenames_in_template_dir(metafunc,
+                                   extensions,
+                                   template_type='',
+                                   sub_dirs=None):
     '''
     returns the filenames in a template_dir, either as its passed in
     on CLI or, during --self-test, the directory whos name matches
@@ -107,26 +106,23 @@ def list_filenames_in_template_dir(
                      for f in listdir(path.join(template_dir, s))
                      if path.isfile(path.join(template_dir, s, f))
                      and path.splitext(f)[-1] in extensions
-                     and check_basename_ending(
-                        template_type,
-                        path.splitext(f)[0])]
+                     and check_basename_ending(template_type,
+                                               path.splitext(f)[0])]
     else:
         filenames = [path.join(template_dir, f)
                      for f in listdir(template_dir)
                      if path.isfile(path.join(template_dir, f))
                      and path.splitext(f)[-1] in extensions
-                     and check_basename_ending(
-                        template_type,
-                        path.splitext(f)[0])]
+                     and check_basename_ending(template_type,
+                                               path.splitext(f)[0])]
     return filenames
 
 
-def list_template_dir(
-            metafunc,
-            extensions,
-            exclude_nested=True,
-            template_type='',
-            sub_dirs=None):
+def list_template_dir(metafunc,
+                      extensions,
+                      exclude_nested=True,
+                      template_type='',
+                      sub_dirs=None):
     '''
     returns the filenames excluding the nested files for a template_dir,
     either as its passed in on CLI or, during --self-test, the
@@ -135,31 +131,27 @@ def list_template_dir(
     sub_dirs = [] if sub_dirs is None else sub_dirs
     filenames = []
     nested_files = []
-    filenames = list_filenames_in_template_dir(
-            metafunc,
-            extensions,
-            template_type,
-            sub_dirs)
+    filenames = list_filenames_in_template_dir(metafunc,
+                                               extensions,
+                                               template_type,
+                                               sub_dirs)
     if exclude_nested:
         nested_files = get_nested_files(filenames)
     return list(set(filenames) - set(nested_files))
 
 
-def get_filenames_list(
-            metafunc,
-            extensions=None,
-            exclude_nested=False,
-            template_type=''):
+def get_filenames_list(metafunc,
+                       extensions=None,
+                       exclude_nested=False,
+                       template_type=''):
     '''
     returns the filename fixtures for the template dir, either as by how its
     passed in on CLI or, during --self-test, the directory whos name
     matches the current tests module name
     '''
-    extensions = [
-            ".yaml",
-            ".yml",
-            ".env"
-            ] if extensions is None else extensions
+    extensions = [".yaml",
+                  ".yml",
+                  ".env"] if extensions is None else extensions
     if metafunc.config.getoption('self_test'):
         filenames_list = list_template_dir(metafunc,
                                            extensions,
@@ -181,21 +173,18 @@ def get_filenames_list(
     return filenames_list
 
 
-def get_filenames_lists(
-            metafunc,
-            extensions=None,
-            exclude_nested=False,
-            template_type=''):
+def get_filenames_lists(metafunc,
+                        extensions=None,
+                        exclude_nested=False,
+                        template_type=''):
     '''
     returns the list of files in the template dir, either as by how its
     passed in on CLI or, during --self-test, the directory whos name
     matches the current tests module name
     '''
-    extensions = [
-            ".yaml",
-            ".yml",
-            ".env"
-            ] if extensions is None else extensions
+    extensions = [".yaml",
+                  ".yml",
+                  ".env"] if extensions is None else extensions
     filenames_lists = []
     if metafunc.config.getoption('self_test'):
         filenames_lists.append(list_template_dir(metafunc,
@@ -204,12 +193,11 @@ def get_filenames_lists(
                                                  template_type,
                                                  ['pass']))
         filenames_lists.append(pytest.mark.xfail(
-                            list_template_dir(metafunc,
-                                              extensions,
-                                              exclude_nested,
-                                              template_type,
-                                              ['fail']),
-                            strict=True))
+            list_template_dir(metafunc,
+                              extensions,
+                              exclude_nested,
+                              template_type,
+                              ['fail']), strict=True))
     else:
         filenames_lists.append(list_template_dir(metafunc,
                                                  extensions,
@@ -218,12 +206,11 @@ def get_filenames_lists(
     return filenames_lists
 
 
-def get_parsed_yaml_files(
-            metafunc,
-            extensions,
-            exclude_nested=True,
-            template_type='',
-            sections=None):
+def get_parsed_yaml_files(metafunc,
+                          extensions,
+                          exclude_nested=True,
+                          template_type='',
+                          sections=None):
     '''
     returns the list of parsed yaml files in the specified template dir,
     either as by how its passed in on CLI or, during --self-test, the