We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Trait
Given a factory with traits, pytest_factoryboy should treat them as normal params, and allow them to be parametrized.
MCVE:
@dataclass class Article: comments: int views: int @register class ArticleFactory(Factory): class Meta: model = Article class Params: boring = Trait( comments=0, views=0, ) comments = 10 views = 1000 @pytest.mark.parametrize("article__boring", [True]) def test_boring_article(article): assert article.comments == 0 assert article.views == 0
The text was updated successfully, but these errors were encountered:
Same here. Is there any workaround this ?
Sorry, something went wrong.
I guess the only workaround for now is to use custom fixtures.So for given MCVE would be something like:
@pytest.fixture() def boring_article(): return ArticleFactory(boring=True)
No branches or pull requests
Given a factory with traits, pytest_factoryboy should treat them as normal params, and allow them to be parametrized.
MCVE:
The text was updated successfully, but these errors were encountered: