Skip to content
New issue

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

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

Already on GitHub? # to your account

Import 'mock' module from 'unittest' library #1415

Merged
merged 1 commit into from
Feb 10, 2021
Merged

Import 'mock' module from 'unittest' library #1415

merged 1 commit into from
Feb 10, 2021

Conversation

jleveque
Copy link
Contributor

@jleveque jleveque commented Feb 9, 2021

As of Python 3, mock is part of unittest in the Python standard library. Since sonic-utilities is now Python 3-only, we should import it this way everywhere.

@jleveque jleveque self-assigned this Feb 9, 2021
@jleveque jleveque marked this pull request as ready for review February 10, 2021 01:38
@qiluo-msft
Copy link
Contributor

qiluo-msft commented Feb 10, 2021

Why unit test did not catch it before?

@jleveque
Copy link
Contributor Author

jleveque commented Feb 10, 2021

Why unit test did not catch it before?

I'm not sure. The third-party mock library must be getting installed in the environment by some other means. It is technically still available for Python 3 via PyPI., even though it is part of the standard lib since Python 3.3.

@jleveque jleveque merged commit 78968a1 into sonic-net:master Feb 10, 2021
@jleveque jleveque deleted the unittest_mock branch February 10, 2021 02:41
anand-kumar-subramanian pushed a commit to anand-kumar-subramanian/sonic-utilities that referenced this pull request Mar 2, 2021
As of Python 3, `mock` is part of `unittest` in the Python standard library. Since sonic-utilities is now Python 3-only, we should import it this way everywhere.
yxieca pushed a commit that referenced this pull request Apr 8, 2021
As of Python 3, `mock` is part of `unittest` in the Python standard library. Since sonic-utilities is now Python 3-only, we should import it this way everywhere.
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants