Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix UT test_BlockUseSwsssdk() #128

Merged
merged 4 commits into from
Nov 10, 2022
Merged
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
13 changes: 11 additions & 2 deletions test/test_moduleLoad.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ def test__dbConfig(self):
def test_BlockUseSwsssdk():
# Import swsssdk will throw exception with deprecated message.
swsssdk_path = os.path.join(modules_path, 'src')
result = subprocess.run(["python", "-c", "import swsssdk;exit()"], capture_output=True, cwd=swsssdk_path)
result = None
python_command = "python"

if sys.version_info.major == 3:
qiluo-msft marked this conversation as resolved.
Show resolved Hide resolved
python_command = "python3"

assert "deprecated" in result.stderr.decode("utf-8")
try:
subprocess.check_output([python_command, "-c", "import swsssdk;exit()"], stderr=subprocess.STDOUT, cwd=swsssdk_path)
except subprocess.CalledProcessError as e:
result = e.output.decode("utf-8")

assert "deprecated" in result