Skip to content

fixture named "request" fails #794

Closed

Description

@spaceone

I created a fixture named "request". Normal tests works with it. If i add mark.parametrize i get the following exception:

/usr/lib/python2.7/site-packages/_pytest/runner.py:149: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ $
/usr/lib/python2.7/site-packages/_pytest/runner.py:137: in <lambda>
    return CallInfo(lambda: ihook(item=item, **kwds), when=when)
/usr/lib/python2.7/site-packages/_pytest/core.py:521: in __call__
    return self._docall(self.methods, kwargs)
/usr/lib/python2.7/site-packages/_pytest/core.py:528: in _docall
    firstresult=self.firstresult).execute()
/usr/lib/python2.7/site-packages/_pytest/core.py:393: in execute
    return wrapped_call(method(*args), self.execute)
/usr/lib/python2.7/site-packages/_pytest/core.py:113: in wrapped_call
    return call_outcome.get_result()
/usr/lib/python2.7/site-packages/_pytest/core.py:138: in get_result
    py.builtin._reraise(*ex)
/usr/lib/python2.7/site-packages/_pytest/core.py:123: in __init__
    self.result = func()
/usr/lib/python2.7/site-packages/_pytest/core.py:394: in execute
    res = method(*args)
/usr/lib/python2.7/site-packages/_pytest/runner.py:86: in pytest_runtest_setup
    item.session._setupstate.prepare(item)
/usr/lib/python2.7/site-packages/_pytest/runner.py:403: in prepare
    col.setup()
/usr/lib/python2.7/site-packages/_pytest/python.py:1187: in setup
    fillfixtures(self)
/usr/lib/python2.7/site-packages/_pytest/python.py:692: in fillfixtures
    request._fillfixtures()
/usr/lib/python2.7/site-packages/_pytest/python.py:1335: in _fillfixtures
    item.funcargs[argname] = self.getfuncargvalue(argname)
/usr/lib/python2.7/site-packages/_pytest/python.py:1378: in getfuncargvalue
    return self._get_active_fixturedef(argname).cached_result[0]
/usr/lib/python2.7/site-packages/_pytest/python.py:1395: in _get_active_fixturedef
    result = self._getfuncargvalue(fixturedef)
/usr/lib/python2.7/site-packages/_pytest/python.py:1441: in _getfuncargvalue
    val = fixturedef.execute(request=subrequest)
/usr/lib/python2.7/site-packages/_pytest/python.py:1907: in execute
    self.yieldctx)
/usr/lib/python2.7/site-packages/_pytest/python.py:1832: in call_fixture_func
    res = fixturefunc(**kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ $

request = <HTTP Request(GET / HTTP/1.1)>

    def get_direct_param_fixture_func(request):
>       return request.param
E       AttributeError: 'Request' object has no attribute 'param'

/usr/lib/python2.7/site-packages/_pytest/python.py:454: AttributeError


Activity

  1. spaceone commented on Jun 21, 2015

    @spaceone
    ContributorAuthor

    duplicate of #611

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions