staticmethod functions are not collected for testing #2528
Closed
Comments
I was attempting to use this, and it doesn't seem to be working quite right with fixtures. Running the following code, import pytest
@pytest.fixture
def foo():
return 'foo'
def test_foo(foo):
assert foo == 'foo'
class TestFoo:
@staticmethod
def test_foo(foo):
assert foo == 'foo' Produces the following error:
The first |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When using classes to group functions, I'm interested in this pattern:
"test_http_requests.py"
Using the
@staticmethod
decorator makes it clear that I'm not using the class for anything but grouping.Unfortunately, pytest fails to collect any method so decorated. If I remove the decorator and add the
self
argument in the above example, pytest collects as expected.Pytest 3.1.2, Python 2.7.13, no virtualenv, MacOS 10.12.5
The text was updated successfully, but these errors were encountered: