eugeniy / pytest-tornado

A py.test plugin providing fixtures and markers to simplify testing of asynchronous tornado applications.
Apache License 2.0
121 stars 34 forks source link

pytestmark isn't working for fixtures #10

Closed fruch closed 5 years ago

fruch commented 9 years ago

using fixtures pytestmark is casuing a test to be skipped:

    @pytest.fixture(scope="session")
    def preparations():
        pass

    @pytest.fixture
    def app():
        return application

    pytestmark = pytest.mark.usefixtures("preparations")

    @pytest.mark.gen_test
    def test_hello_world(http_client, base_url):
         pass

while using is as decorator, it does work:

    @pytest.mark.usefixtures("preparations")
    @pytest.mark.gen_test
    def test_hello_world(http_client, base_url):
         pass

(Didn't had time to actually debug it and check what's the difference, my guess something in the test collection hooks in pytest-tornado)

eugeniy commented 9 years ago

I think you're right, it seems to be related to collection of hooks.

Recent py.test adds hookwrapper which changes how hooks are being invoked. Your example works without any code change with 2.7.0.

fruch commented 9 years ago

Thanks... For the information , I would add it to the docs as warning, but I'm away from my laptop. On Apr 28, 2015 10:20 AM, "Eugeniy Kalinin" notifications@github.com wrote:

I think you're right, it seems to be related to collection of hooks.

Recent py.test adds hookwrapper http://pytest.readthedocs.org/en/latest/plugins.html#hookwrapper-executing-around-other-hooks which changes how hooks are being invoked. Your example works without any code change with 2.7.0.

— Reply to this email directly or view it on GitHub https://github.com/eugeniy/pytest-tornado/issues/10#issuecomment-96955789 .

vidartf commented 5 years ago

As far as I can tell, this was resolved for pytest >= 2.7 (see 8fb97711dd84512a8a654de3dca2bee24689a2a7). Closing for now, but feel free to comment about any remaining problems, and I will reopen.