imports
mock from
https://pypi.org/project/mock/ library directly.
https://pypi.org/project/mock/ library is not needed anymore on modern Python installation, since it is now part of the Python standard library, available as unittest.mock.
This issue was found as a part of packaging the library for Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=2263960.
The solution is to reuse approach in auto-generated code:
|
try: |
|
from unittest import mock |
|
from unittest.mock import AsyncMock # pragma: NO COVER |
|
except ImportError: # pragma: NO COVER |
|
import mock |
google-cloud-python/packages/google-cloud-monitoring/tests/unit/test_query.py
Line 20 in aae7bf5
mockfrom https://pypi.org/project/mock/ library directly.https://pypi.org/project/mock/ library is not needed anymore on modern Python installation, since it is now part of the Python standard library, available as
unittest.mock.This issue was found as a part of packaging the library for Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=2263960.
The solution is to reuse approach in auto-generated code:
google-cloud-python/packages/google-cloud-monitoring/tests/unit/gapic/monitoring_v3/test_alert_policy_service.py
Lines 19 to 23 in aae7bf5