Skip to content
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

[Feature request] Traits as fixtures? #53

Open
David-Guillot opened this issue Sep 6, 2017 · 2 comments
Open

[Feature request] Traits as fixtures? #53

David-Guillot opened this issue Sep 6, 2017 · 2 comments

Comments

@David-Guillot
Copy link

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

@olegpidsadnyi
Copy link
Contributor

I didn't use them yet for my projects :) Need to do some investigation

@stevelacey
Copy link

stevelacey commented Sep 24, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants