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

Test failure test_BlockUseSwsssdk() #12558

Closed
EdenGri opened this issue Oct 31, 2022 · 2 comments
Closed

Test failure test_BlockUseSwsssdk() #12558

EdenGri opened this issue Oct 31, 2022 · 2 comments
Assignees
Labels
MSFT Triaged this issue has been triaged

Comments

@EdenGri
Copy link
Contributor

EdenGri commented Oct 31, 2022

Description

The test test_BlockUseSwsssdk() failed with the error message "AttributeError: 'module' object has no attribute 'run'".
I think that it runs Python 2.7 when the function 'run' of the subprocess (in line 38) is available only in Python 3.5 and newer

The test test_BlockUseSwsssdk() in the sonic-pyswssdk repo failed with the error message "AttributeError: 'module' object has no attribute 'run'".
I think that when we build build_env buster we run Python 2.7 when the function 'run' of the subprocess (in line 38) is available only in Python 3.5 and newer
The commit that adds the test is: e30a1e1e90e6227a771340edcad727255be54b94
The sonic-buildimage not pointing to the commit that adds the tests yet.
This is the submodule update PR with the failure: #12559
image

Steps to reproduce the issue:

  1. build with the commit e30a1e1e90e6227a771340edcad727255be54b94 of the sonic-py-swssdk repo with buster build env

Describe the results you received:

build failure

Describe the results you expected:

build succsses

Output of show version:

(paste your output here)

Output of show techsupport:

(paste your output here or download and attach the file here )

Additional information you deem important (e.g. issue happens only occasionally):

@liuh-80 liuh-80 self-assigned this Nov 1, 2022
@prgeor prgeor added Triaged this issue has been triaged MSFT and removed Triaged this issue has been triaged labels Nov 9, 2022
@prgeor
Copy link
Contributor

prgeor commented Nov 9, 2022

@qiluo-msft could you check why we still using python2.x in test environment?

liuh-80 added a commit to sonic-net/sonic-py-swsssdk that referenced this issue Nov 10, 2022
#### Why I did it
Fix this issue: sonic-net/sonic-buildimage#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'

#### 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)
@liuh-80
Copy link
Contributor

liuh-80 commented Nov 10, 2022

This issue fixed by sonic-net/sonic-py-swsssdk#128

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
MSFT Triaged this issue has been triaged
Projects
None yet
Development

No branches or pull requests

4 participants