Hi Holger,

I am trying to make decorators work with test functions, which depend
on funcargs. As it stands, they don't.
Decorated functions lose funcargs. A workaround would be to decorate
an internal function like this:

def test_it(funcarg_it):
    @decorate_it
    def _test_it():
        # test it

    _test_it()

This works, but it is not nice. I'd rather wrote a decorator like

def decorate_it(f):
    def _wrap_it(*args, **kwargs):
        # wrap f() here

    _wrap_it._varnames = _pytest.core.varnames(f)
    return _wrap_it

and apply it straight to the test function.

After examining the source code I even expected it to just work
(magically of course) but it didn't.
Do you think it is worthwhile? If so I can enter a feature request.

Thanks,
Vyacheslav
_______________________________________________
py-dev mailing list
py-dev@codespeak.net
http://codespeak.net/mailman/listinfo/py-dev

Reply via email to