From bde892efc1c4e0e2af20f20cd3bdbbdf58ea2048 Mon Sep 17 00:00:00 2001 From: Shivam Thakur <70829776+shivamcandela@users.noreply.github.com> Date: Sat, 7 Aug 2021 18:52:52 +0530 Subject: [PATCH] env property fix for 1.x adding environment for 2.x was causing fail for 1.x runs, so added condition --- tests/conftest.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 2f1feaccc..78ee8aec8 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -661,16 +661,18 @@ def add_allure_environment_property(request: SubRequest) -> Optional[Callable]: @fixture(scope='session') def get_uc_ap_version(get_apnos, get_configuration): - version_list = [] - for access_point_info in get_configuration['access_point']: - ap_ssh = get_apnos(access_point_info) - version = ap_ssh.get_ap_version_ucentral() - version_list.append(version) - yield version_list + if request.config.getoption("2.x"): + version_list = [] + for access_point_info in get_configuration['access_point']: + ap_ssh = get_apnos(access_point_info) + version = ap_ssh.get_ap_version_ucentral() + version_list.append(version) + yield version_list @fixture(scope='session') def add_env_properties(get_configuration, get_uc_ap_version, add_allure_environment_property: Callable) -> None: - add_allure_environment_property('Access-Point-Model', get_configuration["access_point"][0]["model"]) - add_allure_environment_property('Access-Point-Firmware-Version', get_uc_ap_version[0].split("\n")[1]) - add_allure_environment_property('Cloud-Controller-SDK-URL', get_configuration["controller"]["url"]) + if request.config.getoption("2.x"): + add_allure_environment_property('Access-Point-Model', get_configuration["access_point"][0]["model"]) + add_allure_environment_property('Access-Point-Firmware-Version', get_uc_ap_version[0].split("\n")[1]) + add_allure_environment_property('Cloud-Controller-SDK-URL', get_configuration["controller"]["url"])