Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion common/sai_dataplane/ptf/sai_ptf_dataplane.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,10 @@ def __logging_setup(config):
@staticmethod
def __import_module(root_path, module_name):
module_specs = importlib.util.find_spec(module_name, [root_path])
return module_specs.loader.load_module()
module = importlib.util.module_from_spec(module_specs)
sys.modules[module_name] = module
module_specs.loader.exec_module(module)
return module

def init(self):
global ptf
Expand Down
6 changes: 5 additions & 1 deletion common/sai_testbed.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import json
import glob
import logging
import sys

from saichallenger.common.sai_dut import SaiDut
from saichallenger.common.sai_npu import SaiNpu
Expand Down Expand Up @@ -111,7 +112,10 @@ def __init__(self, base_dir, name, with_traffic, skip_dataplane=False):
@staticmethod
def import_module(root_path, module_name):
module_specs = importlib.util.spec_from_file_location(module_name, os.path.join(root_path, f"{module_name}.py"))
return module_specs.loader.load_module()
module = importlib.util.module_from_spec(module_specs)
sys.modules[module_name] = module
module_specs.loader.exec_module(module)
return module

@staticmethod
def spawn_asic(base_dir, cfg, asic_type="npu"):
Expand Down
Loading