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

Tests still import mock #18976

Closed
major opened this issue Jul 23, 2021 · 7 comments · Fixed by #18977, Azure/azure-cli-dev-tools#313 or #19024
Closed

Tests still import mock #18976

major opened this issue Jul 23, 2021 · 7 comments · Fixed by #18977, Azure/azure-cli-dev-tools#313 or #19024
Assignees

Comments

@major
Copy link
Contributor

major commented Jul 23, 2021

Describe the bug
The azure-cli-telemetry tests still contain import mock and mock is deprecated in recent python versions.

To Reproduce
Run tests for azure-cli-telemetry on Python 3.10.

Expected behavior
I expect tests to pass.

Environment summary
Installed azure-cli-telemetry 1.0.6 via pip.

Additional context
I'm preparing a PR to fix this.

@ghost ghost added needs-triage This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that customer-reported Issues that are reported by GitHub users external to the Azure organization. labels Jul 23, 2021
@ghost ghost removed the needs-triage This is a new issue that needs to be triaged to the appropriate team. label Jul 23, 2021
@yonzhan yonzhan removed customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Jul 23, 2021
@yonzhan yonzhan added this to the Jul 2021 (2021-08-03) milestone Jul 23, 2021
@yonzhan
Copy link
Collaborator

yonzhan commented Jul 23, 2021

telemetry

@jsntcy jsntcy closed this as completed Jul 26, 2021
@jsntcy jsntcy reopened this Jul 26, 2021
@evelyn-ys evelyn-ys assigned jiasli and unassigned evelyn-ys Jul 27, 2021
@jiasli
Copy link
Member

jiasli commented Jul 27, 2021

Per https://pypi.org/project/mock/:

mock is now part of the Python standard library, available as unittest.mock in Python 3.3 onwards.

As Azure CLI requires Python >= 3.6, we can drop mock.

Actually, this is not the only place where mock is used. It should be dropped everywhere!

@major
Copy link
Contributor Author

major commented Jul 27, 2021

@jiasli That would be really helpful for me as I try to package Azure CLI (and the SDK) in Fedora!

@jiasli
Copy link
Member

jiasli commented Jul 28, 2021

By the way, did you encounter any error in Python 3.10?

@jiasli jiasli changed the title telemetry: client tests still import mock Tests still import mock Jul 28, 2021
@major
Copy link
Contributor Author

major commented Jul 28, 2021

By the way, did you encounter any error in Python 3.10?

Not much in the code itself, but I do notice some testing failures there (using azdev test).

@jiasli
Copy link
Member

jiasli commented Jul 28, 2021

@major, I am not aware of that. Could you share some example failures caused by mock if convenient?

@major
Copy link
Contributor Author

major commented Jul 28, 2021

@major, I am not aware of that. Could you share some example failures caused by mock if convenient?

I'll try to take a look later today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment