Missing ptp config option
Tests were not running due to missing ptp_config option Jira: CGTS-74398 Change-Id: Ic9aefd6c33bf36920e07d6df852cdcfef6d8f285
This commit is contained in:
@@ -1,27 +1,43 @@
|
||||
import os
|
||||
from typing import Any
|
||||
|
||||
from config.configuration_file_locations_manager import ConfigurationFileLocationsManager
|
||||
from config.configuration_file_locations_manager import (
|
||||
ConfigurationFileLocationsManager,
|
||||
)
|
||||
from config.configuration_manager import ConfigurationManager
|
||||
from framework.logging import log_banners
|
||||
from framework.logging.automation_logger import configure_testcase_log_handler, get_logger, remove_testcase_handler
|
||||
from framework.logging.automation_logger import (
|
||||
configure_testcase_log_handler,
|
||||
get_logger,
|
||||
remove_testcase_handler,
|
||||
)
|
||||
|
||||
|
||||
def pytest_addoption(parser):
|
||||
def pytest_addoption(parser: Any):
|
||||
"""
|
||||
Adds the pytest options
|
||||
|
||||
Args:
|
||||
parser (Any): the parser
|
||||
|
||||
"""
|
||||
parser.addoption("--lab_config_file", action="store")
|
||||
parser.addoption("--k8s_config_file", action="store")
|
||||
parser.addoption("--ptp_config_file", action="store")
|
||||
parser.addoption("--logger_config_file", action="store")
|
||||
parser.addoption("--docker_config_file", action="store")
|
||||
parser.addoption("--web_config_file", action="store")
|
||||
parser.addoption("--database_config_file", action="store")
|
||||
parser.addoption("--rest_api_config_file", action="store")
|
||||
|
||||
def pytest_sessionstart(session):
|
||||
|
||||
def pytest_sessionstart(session: Any):
|
||||
"""
|
||||
This is run once at test start up.
|
||||
Returns:
|
||||
|
||||
Args:
|
||||
session (Any): the session
|
||||
"""
|
||||
|
||||
configuration_locations_manager = ConfigurationFileLocationsManager()
|
||||
|
||||
configuration_locations_manager.set_configs_from_pytest_args(session)
|
||||
@@ -34,7 +50,6 @@ def log_configuration():
|
||||
"""
|
||||
This function will log all the configurations that are loaded
|
||||
"""
|
||||
|
||||
get_logger().log_debug("----- LOGGER CONFIG -----")
|
||||
for config_string in ConfigurationManager.get_logger_config().to_log_strings():
|
||||
get_logger().log_debug(config_string)
|
||||
@@ -44,50 +59,46 @@ def log_configuration():
|
||||
get_logger().log_debug(config_string)
|
||||
|
||||
|
||||
def pytest_runtest_setup(item):
|
||||
def pytest_runtest_setup(item: Any):
|
||||
"""
|
||||
This will run before any test case starts its execution
|
||||
Args:
|
||||
item: The test case item that we are about to execute.
|
||||
|
||||
Returns: None
|
||||
Args:
|
||||
item(Any): The test case item that we are about to execute.
|
||||
|
||||
"""
|
||||
|
||||
# add testcase log handler at test start
|
||||
configure_testcase_log_handler(ConfigurationManager.get_logger_config(), item.name)
|
||||
log_banners.log_test_start_banner(item)
|
||||
|
||||
|
||||
def pytest_runtest_makereport(item, call):
|
||||
def pytest_runtest_makereport(item: Any, call: Any):
|
||||
"""
|
||||
This Pytest hook gets called after the execution of a test case or test suite.
|
||||
Args:
|
||||
item: The test case that was executed.
|
||||
call: Information about the execution.
|
||||
|
||||
Returns: None
|
||||
Args:
|
||||
item(Any): The test case that was executed.
|
||||
call(Any): Information about the execution.
|
||||
|
||||
"""
|
||||
|
||||
# Handle Exceptions that happened during the test case.
|
||||
if call.excinfo:
|
||||
log_exception(call.excinfo)
|
||||
if call.when == 'teardown':
|
||||
if call.when == "teardown":
|
||||
# remove testcase logger file handler at end of each test
|
||||
remove_testcase_handler(item.name)
|
||||
|
||||
|
||||
def log_exception(exception_info):
|
||||
def log_exception(exception_info: Any):
|
||||
"""
|
||||
This function will log the StackTrace of the exception_info passed in.
|
||||
|
||||
Args:
|
||||
exception_info (ExceptionInfo): Obtained from call.excinfo in pytest_runtest_makereport
|
||||
exception_info (Any): Obtained from call.excinfo in pytest_runtest_makereport
|
||||
|
||||
Returns: None
|
||||
|
||||
"""
|
||||
|
||||
get_logger().log_exception("")
|
||||
get_logger().log_exception("---------- EXCEPTION ----------")
|
||||
|
||||
@@ -97,7 +108,7 @@ def log_exception(exception_info):
|
||||
for entry in full_traceback:
|
||||
|
||||
# Skip over the keyword-wrapping-hook
|
||||
if entry.name == 'on_keyword_wrapped_function':
|
||||
if entry.name == "on_keyword_wrapped_function":
|
||||
continue
|
||||
|
||||
# Skip over run_engine functions
|
||||
|
Reference in New Issue
Block a user