aboutsummaryrefslogtreecommitdiffstats
path: root/ice_validator/tests/conftest.py
diff options
context:
space:
mode:
authorLovett, Trevor <trevor.lovett@att.com>2019-07-30 08:50:48 -0700
committerLovett, Trevor (tl2972) <tl2972@att.com>2019-08-16 16:42:09 -0500
commit940ae7b0283191d590de40b71a9136bebc80e83c (patch)
tree8924052bded9411f87212969e1e51ee388e2be20 /ice_validator/tests/conftest.py
parent14c5243cbbb0652ee9ad99519d7d456f5a6c88f4 (diff)
[VVP] Adding preload generation functionality
preload.py discovers and loads implementations of AbstractPreloadGenerator from any module on sys.path prefixed with preload_* Initial support is provided for VNF-API and GR-API. The templates will provide a guide for users to provide their values. Known limitations: - No support for Contrail. Preload will be created, but contrail parameters will be skipped. This will be addressed in the future. Issue-ID: VVP-227 Signed-off-by: stark, steven <steven.stark@att.com> Change-Id: I081d50ac379062fbf1bffebd687e920220d32571 Signed-off-by: Lovett, Trevor <trevor.lovett@att.com> Signed-off-by: Lovett, Trevor (tl2972) <tl2972@att.com>
Diffstat (limited to 'ice_validator/tests/conftest.py')
-rw-r--r--ice_validator/tests/conftest.py27
1 files changed, 13 insertions, 14 deletions
diff --git a/ice_validator/tests/conftest.py b/ice_validator/tests/conftest.py
index 5653cca..f4b3857 100644
--- a/ice_validator/tests/conftest.py
+++ b/ice_validator/tests/conftest.py
@@ -43,6 +43,10 @@ import json
import os
import re
import time
+
+from preload import create_preloads
+from tests.helpers import get_output_dir
+
try:
from html import escape
except ImportError:
@@ -95,18 +99,6 @@ COLLECTION_FAILURES = []
ALL_RESULTS = []
-def get_output_dir(config):
- """
- Retrieve the output directory for the reports and create it if necessary
- :param config: pytest configuration
- :return: output directory as string
- """
- output_dir = config.option.output_dir or DEFAULT_OUTPUT_DIR
- if not os.path.exists(output_dir):
- os.makedirs(output_dir, exist_ok=True)
- return output_dir
-
-
def extract_error_msg(rep):
"""
If a custom error message was provided, then extract it otherwise
@@ -352,6 +344,12 @@ def pytest_sessionfinish(session, exitstatus):
)
+def pytest_terminal_summary(terminalreporter, exitstatus):
+ # Ensures all preload information and warnings appear after
+ # test results
+ create_preloads(terminalreporter.config, exitstatus)
+
+
# noinspection PyUnusedLocal
def pytest_collection_modifyitems(session, config, items):
"""
@@ -749,8 +747,9 @@ def generate_html_report(outpath, categories, template_path, failures):
{
"file_links": make_href(failure.files, template_path),
"test_id": failure.test_id,
- "error_message": escape(failure.error_message).replace("\n",
- "<br/><br/>"),
+ "error_message": escape(failure.error_message).replace(
+ "\n", "<br/><br/>"
+ ),
"raw_output": escape(failure.raw_output),
"requirements": docutils.core.publish_parts(
writer_name="html", source=failure.requirement_text(reqs)