Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

Commit 2b7f73e

Browse files
committed
fix mock import location
1 parent 3d4f590 commit 2b7f73e

6 files changed

Lines changed: 24 additions & 18 deletions

File tree

gapic/templates/%namespace/%name_%version/%sub/_compat/legacy_helpers.py.j2

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,8 @@
22

33
{% block content %}
44

5-
import os
65

7-
# try/except added for compatibility with python < 3.8
8-
try:
9-
from unittest import mock
10-
except ImportError: # pragma: NO COVER
11-
import mock
6+
import os
127

138
from google.auth.exceptions import MutualTLSChannelError # type: ignore
149

gapic/templates/tests/unit/gapic/%name_%version/%sub/test_legacy_helpers.py.j2

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55

66
import os
77

8+
# try/except added for compatibility with python < 3.8
9+
try:
10+
from unittest import mock
11+
except ImportError: # pragma: NO COVER
12+
import mock
13+
14+
815
from {% if api.naming.module_namespace %}{{ api.naming.module_namespace|join('.') }}.{% endif %}
916
{{- api.naming.versioned_module_name }}._compat import legacy_helpers
1017

tests/integration/goldens/asset/google/cloud/asset_v1/_compat/legacy_helpers.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,8 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
import os
1716

18-
# try/except added for compatibility with python < 3.8
19-
try:
20-
from unittest import mock
21-
except ImportError: # pragma: NO COVER
22-
import mock
17+
import os
2318

2419
from google.auth.exceptions import MutualTLSChannelError # type: ignore
2520

tests/integration/goldens/asset/tests/unit/gapic/asset_v1/test_legacy_helpers.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@
1616

1717
import os
1818

19+
# try/except added for compatibility with python < 3.8
20+
try:
21+
from unittest import mock
22+
except ImportError: # pragma: NO COVER
23+
import mock
24+
25+
1926
from google.cloud.asset_v1._compat import legacy_helpers
2027

2128

tests/integration/goldens/redis/google/cloud/redis_v1/_compat/legacy_helpers.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,8 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
import os
1716

18-
# try/except added for compatibility with python < 3.8
19-
try:
20-
from unittest import mock
21-
except ImportError: # pragma: NO COVER
22-
import mock
17+
import os
2318

2419
from google.auth.exceptions import MutualTLSChannelError # type: ignore
2520

tests/integration/goldens/redis/tests/unit/gapic/redis_v1/test_legacy_helpers.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@
1616

1717
import os
1818

19+
# try/except added for compatibility with python < 3.8
20+
try:
21+
from unittest import mock
22+
except ImportError: # pragma: NO COVER
23+
import mock
24+
25+
1926
from google.cloud.redis_v1._compat import legacy_helpers
2027

2128

0 commit comments

Comments
 (0)