pytest-factoryboy
pytest-factoryboy copied to clipboard
[Feature request] Traits as fixtures?
Hi,
I'd like to parametrize use of a Factoryboy Trait. But i don't see my Traits when i list my fixtures, so i get there is something missing here.
I honestly don't know if that would even be possible, so if it's not, please explain why ;) Thanks
I didn't use them yet for my projects :) Need to do some investigation
Here's what I expected it to be:
class UserFactory(DjangoModelFactory):
class Params:
my_trait = factory.Trait(
has_done_thing=True,
something_else=1,
# ...
)
@pytest.mark.parametrize("user__my_trait", [True])
@pytest.mark.parametrize("user__something_else", [2])
Traits are primarily a shortcut for supplying lots of parameters by wrapping them up under one bool, and they can still be overridden, so I expected pytest-factoryboy to follow the same pattern.