Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: use_args() got an unexpected keyword argument 'location' #157

Closed
mekanix opened this issue Jun 7, 2020 · 1 comment
Closed

Comments

@mekanix
Copy link

mekanix commented Jun 7, 2020

The error is very similar to #117 so I'm wondering if there's something outdated on my side. Anyway, this is the trace for one of the failing tests:

self = <tests.test_pagination.TestPagination object at 0x803b8c750>, app = <Flask 'API Test'>, schemas = Model(DocSchema=<class 'tests.conftest.schemas.<locals>.DocSchema'>, DocEtagSchema=<class 'tests.conftest.schemas.<locals>.DocEtagSchema'>, QueryArgsSchema=<class 'tests.conftest.schemas.<locals>.QueryArgsSchema'>)

    def test_pagination_parameters_and_query_string_args(self, app, schemas):
        api = Api(app)
        blp = Blueprint('test', __name__, url_prefix='/test')

        @blp.route('/')
        @blp.arguments(schemas.QueryArgsSchema, location="query")
        @blp.response()
>       @blp.paginate(Page)
        def func(query_args):

tests/test_pagination.py:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

func = <function TestPagination.test_pagination_parameters_and_query_string_args.<locals>.func at 0x80438a7a0>

    def decorator(func):

        @wraps(func)
        def wrapper(*f_args, **f_kwargs):
            return func(*f_args, **f_kwargs)

        # Add parameter to parameters list in doc info in function object
        # The deepcopy avoids modifying the wrapped function doc
        wrapper._apidoc = deepcopy(getattr(wrapper, '_apidoc', {}))
        docs = wrapper._apidoc.setdefault('arguments', {})
        docs.setdefault('parameters', []).append(parameters)
        docs.setdefault('responses', {})[
            error_status_code
        ] = http.HTTPStatus(error_status_code).name

        # Call use_args (from webargs) to inject params in function
        return self.ARGUMENTS_PARSER.use_args(
>           schema, location=location, **kwargs)(wrapper)
E       TypeError: use_args() got an unexpected keyword argument 'location'

OS is FreeBSD and Python is 3.7.7.

@mekanix
Copy link
Author

mekanix commented Jun 7, 2020

I'm sorry for the noise, I had dangling stuff in ~/.local which is searched before OS Python path. Plase ignore me :o)

@mekanix mekanix closed this as completed Jun 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant