pytest-lazy-fixture icon indicating copy to clipboard operation
pytest-lazy-fixture copied to clipboard

prepare for the deprecation/removal of the pytest_namespace hook

Open RonnyPfannschmidt opened this issue 7 years ago • 6 comments

in pytest we are in the process of deprecating the pytest_namespace hook, so this plugin would need a new location for its api that works when that hook is removed

RonnyPfannschmidt avatar Nov 10 '17 09:11 RonnyPfannschmidt

Hi! Thanks for informing me! So one day pytest will stop invoking pytest_namespace and the right way of using these plugins would be just importing them?

TvoroG avatar Nov 10 '17 10:11 TvoroG

@TvoroG correct

RonnyPfannschmidt avatar Nov 10 '17 10:11 RonnyPfannschmidt

If anyone else would be encountering the same error as I am: it seems that pytest.lazyfixture is now being added áfter conftest.py (cfr. https://docs.pytest.org/en/latest/deprecations.html#pytest-namespace).

So to use lazyfixture to create 'globally-shared fixtures', you will have to import pytest_lazyfixture and use pytest_lazyfixture.lazyfixture (if I got that correctly?)

YannickJadoul avatar Oct 01 '18 15:10 YannickJadoul

If anyone else would be encountering the same error as I am: it seems that pytest.lazyfixture is now being added áfter conftest.py (cfr. https://docs.pytest.org/en/latest/deprecations.html#pytest-namespace).

So to use lazyfixture to create 'globally-shared fixtures', you will have to import pytest_lazyfixture and use pytest_lazyfixture.lazyfixture (if I got that correctly?)

I had the exact same problem: I was trying to use pytest.lazy_fixture in conftest.py. Importing it from pytest_lazyfixture instead worked!

jmehnle avatar Nov 13 '20 23:11 jmehnle

deprecate pytest_namespace alltogether – https://github.com/pytest-dev/pytest/issues/2639 remove pytest namespace hook – https://github.com/pytest-dev/pytest/pull/4421 #4421: Removed the implementation of the pytest_namespace hook. (note from changelog of pytest 4.1.0 (2019-01-05)) – https://docs.pytest.org/en/stable/changelog.html#id648

piotr-dobrogost avatar May 21 '21 10:05 piotr-dobrogost

@TvoroG I appreciate your hard work. I really do. But, pls, for the love of everything that is good, do update the README. Thanks in advance.

z33kz33k avatar Nov 17 '21 15:11 z33kz33k

closing this as it seems to be resolved

RonnyPfannschmidt avatar Jan 08 '24 10:01 RonnyPfannschmidt