File tree Expand file tree Collapse file tree 4 files changed +15
-4
lines changed Expand file tree Collapse file tree 4 files changed +15
-4
lines changed Original file line number Diff line number Diff line change 4949
5050@pytest .fixture (scope = 'module' , params = [{'emulated' : False }, {'emulated' : True }])
5151def user_mgt_app (request ):
52- monkeypatch = pytest . MonkeyPatch ()
52+ monkeypatch = testutils . new_monkeypatch ()
5353 if request .param ['emulated' ]:
5454 monkeypatch .setenv (EMULATOR_HOST_ENV_VAR , AUTH_EMULATOR_HOST )
5555 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):
148148 This can be used in any scenario where the private key is required. Use user_mgt_app
149149 for everything else.
150150 """
151- monkeypatch = pytest . MonkeyPatch ()
151+ monkeypatch = testutils . new_monkeypatch ()
152152 if request .param ['emulated' ]:
153153 monkeypatch .setenv (EMULATOR_HOST_ENV_VAR , AUTH_EMULATOR_HOST )
154154 monkeypatch .setitem (TOKEN_MGT_URLS , 'ID_TOOLKIT' , EMULATED_ID_TOOLKIT_URL )
@@ -159,7 +159,7 @@ def auth_app(request):
159159
160160@pytest .fixture (scope = 'module' , params = [{'emulated' : False }, {'emulated' : True }])
161161def user_mgt_app (request ):
162- monkeypatch = pytest . MonkeyPatch ()
162+ monkeypatch = testutils . new_monkeypatch ()
163163 if request .param ['emulated' ]:
164164 monkeypatch .setenv (EMULATOR_HOST_ENV_VAR , AUTH_EMULATOR_HOST )
165165 monkeypatch .setitem (TOKEN_MGT_URLS , 'ID_TOOLKIT' , EMULATED_ID_TOOLKIT_URL )
Original file line number Diff line number Diff line change 6262
6363@pytest .fixture (scope = 'module' , params = [{'emulated' : False }, {'emulated' : True }])
6464def user_mgt_app (request ):
65- monkeypatch = pytest . MonkeyPatch ()
65+ monkeypatch = testutils . new_monkeypatch ()
6666 if request .param ['emulated' ]:
6767 monkeypatch .setenv (EMULATOR_HOST_ENV_VAR , AUTH_EMULATOR_HOST )
6868 monkeypatch .setitem (USER_MGT_URLS , 'ID_TOOLKIT' , EMULATED_ID_TOOLKIT_URL )
Original file line number Diff line number Diff line change 1616import io
1717import os
1818
19+ import pytest
20+
1921from google .auth import credentials
2022from google .auth import transport
2123from requests import adapters
@@ -58,6 +60,15 @@ def run_without_project_id(func):
5860 os .environ [env_var ] = gcloud_project
5961
6062
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+
6172class MockResponse (transport .Response ):
6273 def __init__ (self , status , response ):
6374 self ._status = status
You can’t perform that action at this time.
0 commit comments