Skip to content

Commit 8aba5e0

Browse files
committed
Run away from getfuncargvalue deprecation.
1 parent a392889 commit 8aba5e0

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

pytest_flask/plugin.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
client, config, accept_json, accept_jsonp, accept_any, accept_mimetype,
1616
client_class, live_server, request_ctx
1717
)
18+
from .pytest_compat import getfixturevalue
1819

1920

2021
class JSONResponse(object):
@@ -58,7 +59,7 @@ def test_json(client):
5859
if 'app' not in request.fixturenames:
5960
return
6061

61-
app = request.getfuncargvalue('app')
62+
app = getfixturevalue(request, 'app')
6263
monkeypatch.setattr(app, 'response_class',
6364
_make_test_response_class(app.response_class))
6465

@@ -75,14 +76,14 @@ def test_app(app, client):
7576
if 'app' not in request.fixturenames:
7677
return
7778

78-
app = request.getfuncargvalue('app')
79+
app = getfixturevalue(request, 'app')
7980

8081
# Get application bound to the live server if ``live_server`` fixture
8182
# is applyed. Live server application has an explicit ``SERVER_NAME``,
8283
# so ``url_for`` function generates a complete URL for endpoint which
8384
# includes application port as well.
8485
if 'live_server' in request.fixturenames:
85-
app = request.getfuncargvalue('live_server').app
86+
app = getfixturevalue(request, 'live_server').app
8687

8788
ctx = app.test_request_context()
8889
ctx.push()
@@ -106,7 +107,7 @@ def test_something(app):
106107
if 'app' not in request.fixturenames:
107108
return
108109

109-
app = request.getfuncargvalue('app')
110+
app = getfixturevalue(request, 'app')
110111
options = request.keywords.get('options')
111112
if options is not None:
112113
for key, value in options.kwargs.items():

pytest_flask/pytest_compat.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
def getfixturevalue(request, value):
2+
if hasattr(request, 'getfixturevalue'):
3+
return request.getfixturevalue(value)
4+
5+
return requesgit (value)

0 commit comments

Comments
 (0)