-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
staticmethod functions are not collected for testing #2528
Comments
4 tasks
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: