[pytest-dev] process for replacing yield tests with modern style

Chris Dent cdent at anticdent.org
Fri Oct 28 09:04:08 EDT 2016


On Sat, 22 Oct 2016, holger krekel wrote:

> maybe there is a solution ...

Thanks I think this has potentially given me enough to at least fix
the old simple version found in:

> So let's now get to your original example at
> https://github.com/tiddlyweb/tiddlyweb/blob/master/test/http_runner.py

and that might be enough to increase my understanding so that I can
deal with the considerably more complex form used in gabbi. I'll
come back to this thread with:

* a link to the change in tiddlyweb when it is working
* questions when I get stuck with gabbi

>    def pytest_generate_tests(metafunc):
>        if metafunc.function == test_generic:
>            l = []
>            for test_data in tests:
>                test = dict(EMPTY_TEST)
>                test.update(test_data)
>                l.append(test)
>
>            metafunc.parametrize("test", argvalues=l, ids=ids)
>
>    def test_generic(test):
>        ...
>
> haven't tested this -- does it work for you?

I had to make some minor modifications and get the methods in the
right files, but I was able to get something roughly working that
once cleaned up will be okay.

Thanks.

-- 
Chris Dent               ┬─┬ノ( º _ ºノ)        https://anticdent.org/
freenode: cdent                                         tw: @anticdent


More information about the pytest-dev mailing list