@pytest.fixture(autouse=True)
def _push_request_context(request):
    """During tests execution request context has been pushed, e.g. `url_for`,
    `session`, etc. can be used in tests as is::

        def test_app(app, client):
            assert client.get(url_for('myview')).status_code == 200

    """
    if 'app' not in request.fixturenames:
        return

    app = request.getfuncargvalue('app')

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

    ctx = app.test_request_context()
    ctx.push()

    def teardown():
        ctx.pop()

    request.addfinalizer(teardown)
dataset/ETHPy150Open vitalk/pytest-flask/pytest_flask/plugin.py/_push_request_context/swapped operands of `in`