def app(request):
    """Use `pytest.mark` decorator to pass options to your application
    factory or configure extension::

        @pytest.mark.options(static_folder='assets')
        def test_app(app):
            pass

    """
    options = dict(debug=True, testing=True, secret='secret')
    extra_options = {}

    # Update application options from pytest environment if they names
    # match with factory spec and use them to configure extension otherwise.
    func_spec = inspect.getargspec(create_app)
    if 'options' in request.keywords:
        for name, value in request.keywords['options'].kwargs.items():
            if name in func_spec.args:
                options[name] = value
            else:
                extra_options[key(name)] = value

    app = create_app(**options)
    app.config.update(extra_options)

    Styleguide(app)

    return app
def test_append_extension_prefix_to_config_key():
    assert key('key').startswith('STYLEGUIDE')
def test_uppercase_config_key():
    assert key('template') == 'STYLEGUIDE_TEMPLATE'