[pytest-dev] fixtures and pylint W0621

Brianna Laugher brianna.laugher at gmail.com
Tue Dec 3 04:51:09 CET 2013


Hi,

On 26 November 2013 18:58, holger krekel <holger at merlinux.eu> wrote:
> I use flakes and pep8 (pytest-flakes and pytest-pep8) and don't get this
> error.  What you can immediately do but which is not pretty is to use
> the old naming scheme together with a decorator:
>
>     import pytest
>
>     @pytest.fixture
>     def pytest_funcarg__somefixture(...):
>         ...
>
> This should avoid the pylint warning.

Ah, that's cool - I didn't realise that was possible.

However, it doesn't work the way you describe. :) Not sure if your
description or the code is backwards!

At the moment (pytest-2.3.5) if I have two fixtures like this:


@py.test.fixture
def pytest_funcarg__foo2(monkeypatch):
    return monkeypatch


def pytest_funcarg__foo3(monkeypatch):
    return monkeypatch


foo3 works (!). foo2 causes an assertion error on collection.

The code in parsefactories has a couple of if blocks, maybe one is inverted. :)

Don't know if this is a good idea, but you could tell if it was new
style/old style based on if the parameter was 'request' or
nothing/other fixtures.

cheers
Brianna


-- 
They've just been waiting in a mountain for the right moment:
http://modernthings.org/


More information about the Pytest-dev mailing list