-
Notifications
You must be signed in to change notification settings - Fork 42
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
factory.DictFactory fixtures have incorrect names #65
Comments
As a work around I use this method: register(OAuthPayloadFactory, _name='o_auth_payload') but it feels weird. |
New workaround: import factory
from mimesis_factory import MimesisField
from pytest_factoryboy import register
try:
from mypy_extensions import TypedDict # typechecks your dicts
except ImportError:
TypedDict = dict # does nothing
class GitlabUserPayload(TypedDict):
"""
Gitlab API response for user endpoint request.
We define this class here, since we do not actually use it in the code.
"""
username: str
email: str
name: str
@register
class GitlabUserPayloadFactory(factory.BaseDictFactory):
"""Fake factory for Gitlab's user response."""
class Meta:
model = GitlabUserPayload
username = MimesisField('username')
email = MimesisField('email')
name = MimesisField('full_name') |
Actually the behaviour you are describing is not the bug. The name of the fixture by the convention, as stated in the docs is:
So in first case there is no underlying model called |
Fixed in #167 |
Here's a reproduction:
When trying to access this fixture I get an error:
What I expect to happen
I expect that
o_auth_payload
would be injected as a fixture.What actually happens
pytest --fixtures output
env
pytest==3.6.1
pytest-factoryboy==2.0.1
factory-boy==2.11.1
The text was updated successfully, but these errors were encountered: