-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
topic: parametrizerelated to @pytest.mark.parametrizerelated to @pytest.mark.parametrize
Description
I am encountering an error when using pytest_generate_tests
with @staticmethod
:
My goal is to create a MaxFlow
class that other test files can inherit from and insert fixtures to all tests within the MaxFlow
class. Everything is working fine, except for this minor edge case that requires me to add self
instead of @staticmethod
.
pytest:
In test_that_gives_an_error: function uses no argument 'max_flow_fn'
# max_flow.py
class MaxFlow:
@staticmethod
def test_that_gives_an_error(max_flow_fn):
...
def test_that_works_correctly(self, max_flow_fn):
...
# test_max_flow.py
class TestKarp(MaxFlow):
max_flow_fn = edmonds_karp_max_flow_fn
def pytest_generate_tests(metafunc):
metafunc.parametrize("max_flow_fn", [metafunc.cls.max_flow_fn])
Pytest 6.2.0
Mac OS
Metadata
Metadata
Assignees
Labels
topic: parametrizerelated to @pytest.mark.parametrizerelated to @pytest.mark.parametrize