Closed liuh-80 closed 2 years ago
Fix this issue: https://github.com/sonic-net/sonic-buildimage/issues/12558 UT failed under python2: test_BlockUseSwsssdk()
result = subprocess.run(["python", "-c", "import swsssdk;exit()"], capture_output=True, cwd=swsssdk_path) E AttributeError: 'module' object has no attribute 'run'
result = subprocess.run(["python", "-c", "import swsssdk;exit()"], capture_output=True, cwd=swsssdk_path)
E AttributeError: 'module' object has no attribute 'run'
Update UT to use subprocess.check_output(), which support by both python3 and python2.
Pass all UT.
Fix UT test_BlockUseSwsssdk()
Tested with this PR: https://github.com/sonic-net/sonic-buildimage/pull/12565
Why I did it
Fix this issue: https://github.com/sonic-net/sonic-buildimage/issues/12558 UT failed under python2: test_BlockUseSwsssdk()
How I did it
Update UT to use subprocess.check_output(), which support by both python3 and python2.
How to verify it
Pass all UT.
Which release branch to backport (provide reason below if selected)
Description for the changelog
Fix UT test_BlockUseSwsssdk()
Link to config_db schema for YANG module changes
A picture of a cute animal (not mandatory but encouraged)