File tree 4 files changed +15
-4
lines changed
4 files changed +15
-4
lines changed Original file line number Diff line number Diff line change 49
49
50
50
@pytest .fixture (scope = 'module' , params = [{'emulated' : False }, {'emulated' : True }])
51
51
def user_mgt_app (request ):
52
- monkeypatch = pytest . MonkeyPatch ()
52
+ monkeypatch = testutils . new_monkeypatch ()
53
53
if request .param ['emulated' ]:
54
54
monkeypatch .setenv (EMULATOR_HOST_ENV_VAR , AUTH_EMULATOR_HOST )
55
55
monkeypatch .setitem (USER_MGT_URLS , 'ID_TOOLKIT' , EMULATED_ID_TOOLKIT_URL )
Original file line number Diff line number Diff line change @@ -148,7 +148,7 @@ def auth_app(request):
148
148
This can be used in any scenario where the private key is required. Use user_mgt_app
149
149
for everything else.
150
150
"""
151
- monkeypatch = pytest . MonkeyPatch ()
151
+ monkeypatch = testutils . new_monkeypatch ()
152
152
if request .param ['emulated' ]:
153
153
monkeypatch .setenv (EMULATOR_HOST_ENV_VAR , AUTH_EMULATOR_HOST )
154
154
monkeypatch .setitem (TOKEN_MGT_URLS , 'ID_TOOLKIT' , EMULATED_ID_TOOLKIT_URL )
@@ -159,7 +159,7 @@ def auth_app(request):
159
159
160
160
@pytest .fixture (scope = 'module' , params = [{'emulated' : False }, {'emulated' : True }])
161
161
def user_mgt_app (request ):
162
- monkeypatch = pytest . MonkeyPatch ()
162
+ monkeypatch = testutils . new_monkeypatch ()
163
163
if request .param ['emulated' ]:
164
164
monkeypatch .setenv (EMULATOR_HOST_ENV_VAR , AUTH_EMULATOR_HOST )
165
165
monkeypatch .setitem (TOKEN_MGT_URLS , 'ID_TOOLKIT' , EMULATED_ID_TOOLKIT_URL )
Original file line number Diff line number Diff line change 64
64
65
65
@pytest .fixture (scope = 'module' , params = [{'emulated' : False }, {'emulated' : True }])
66
66
def user_mgt_app (request ):
67
- monkeypatch = pytest . MonkeyPatch ()
67
+ monkeypatch = testutils . new_monkeypatch ()
68
68
if request .param ['emulated' ]:
69
69
monkeypatch .setenv (EMULATOR_HOST_ENV_VAR , AUTH_EMULATOR_HOST )
70
70
monkeypatch .setitem (USER_MGT_URLS , 'ID_TOOLKIT' , EMULATED_ID_TOOLKIT_URL )
Original file line number Diff line number Diff line change 16
16
import io
17
17
import os
18
18
19
+ import pytest
20
+
19
21
from google .auth import credentials
20
22
from google .auth import transport
21
23
from requests import adapters
@@ -58,6 +60,15 @@ def run_without_project_id(func):
58
60
os .environ [env_var ] = gcloud_project
59
61
60
62
63
+ def new_monkeypatch ():
64
+ try :
65
+ return pytest .MonkeyPatch ()
66
+ except AttributeError :
67
+ # Fallback for Python 3.5
68
+ from _pytest .monkeypatch import MonkeyPatch
69
+ return MonkeyPatch ()
70
+
71
+
61
72
class MockResponse (transport .Response ):
62
73
def __init__ (self , status , response ):
63
74
self ._status = status
You can’t perform that action at this time.
0 commit comments