Skip to content

Commit

Permalink
Support passing generators to parametrize
Browse files Browse the repository at this point in the history
  • Loading branch information
stevelacey committed Jan 13, 2023
1 parent e4d7d50 commit 6f9a73d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from functools import wraps

import pytest
import pytest_factoryboy

Expand All @@ -6,9 +8,12 @@
register = pytest_factoryboy.register


@wraps(pytest.mark.kwparametrize)
def parametrize(*args, **kwargs):
if not args:
return pytest.mark.kwparametrize(kwargs)
if isinstance(args[0], dict):
return pytest.mark.kwparametrize(*args, **kwargs)
if len(args) == 1 and not kwargs:
return pytest.mark.kwparametrize(*args[0])
return pytest.mark.parametrize(*args, **kwargs)

0 comments on commit 6f9a73d

Please sign in to comment.