From aa2e67432bca3f4f0d58fb8b51e1bf54134267a4 Mon Sep 17 00:00:00 2001 From: erinnerim Date: Fri, 10 Sep 2021 15:29:35 -0700 Subject: [PATCH] importlib refactor create_chamberview_dut.py --- py-scripts/create_chamberview_dut.py | 13 +++++++------ py-scripts/lf_dataplane_test.py | 2 -- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/py-scripts/create_chamberview_dut.py b/py-scripts/create_chamberview_dut.py index 28bb03d0..24c6682d 100755 --- a/py-scripts/create_chamberview_dut.py +++ b/py-scripts/create_chamberview_dut.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 - """ Note: To Run this script gui should be opened with @@ -45,9 +44,9 @@ How to Run this: Output : DUT will be created in Chamber View """ - import sys import os +import importlib import argparse import time @@ -55,11 +54,13 @@ if sys.version_info[0] != 3: print("This script requires Python 3") exit(1) -if 'py-json' not in sys.path: - sys.path.append(os.path.join(os.path.abspath('..'), 'py-json')) +if 'lanforge-scripts' not in sys.path: + sys.path.append(os.path.join(os.path.abspath(__file__ + "../../../../"))) -from cv_dut_profile import cv_dut as dut -from cv_test_manager import cv_test as cvtest +cv_dut_profile = importlib.import_module("lanforge-scripts.py-json.cv_dut_profile") +dut = cv_dut_profile.cv_dut +cv_test_manager = importlib.import_module("lanforge-scripts.py-json.cv_test_manager") +cvtest = cv_test_manager.cv_test class DUT(dut): diff --git a/py-scripts/lf_dataplane_test.py b/py-scripts/lf_dataplane_test.py index dfe32414..07bf78d1 100755 --- a/py-scripts/lf_dataplane_test.py +++ b/py-scripts/lf_dataplane_test.py @@ -108,8 +108,6 @@ if sys.version_info[0] != 3: if 'lanforge-scripts' not in sys.path: sys.path.append(os.path.join(os.path.abspath(__file__ + "../../../"))) -# from cv_test_manager import cv_test -# from cv_test_manager import * cv_test_manager = importlib.import_module("lanforge-scripts.py-json.cv_test_manager") cv_test = cv_test_manager.cv_test cv_add_base_parser = cv_test_manager.cv_add_base_parser