Skip to content

Commit 5b2c0f6

Browse files
Refactored for graceful shutdown, fixing UT - Final round of tweaks
1 parent b959da9 commit 5b2c0f6

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

sonic-chassisd/tests/test_dpu_chassisd.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,21 @@
44
import pytest
55
import signal
66
import threading
7-
from imp import load_source
7+
import importlib
88
import re
99

1010
from mock import MagicMock
1111
from sonic_py_common import daemon_base
1212

1313
from .mock_platform import MockDpuChassis
14+
15+
# Make scripts/ importable so `import chassisd` resolves
16+
_REPO_ROOT = os.path.dirname(os.path.dirname(__file__))
17+
_SCRIPTS_DIR = os.path.join(_REPO_ROOT, "scripts")
18+
if _SCRIPTS_DIR not in sys.path:
19+
sys.path.insert(0, _SCRIPTS_DIR)
20+
21+
chassisd = importlib.import_module("chassisd")
1422
from chassisd import *
1523

1624

0 commit comments

Comments
 (0)