Skip to content

Commit

Permalink
Failing test for using a attributes field on the factory (#48)
Browse files Browse the repository at this point in the history
```
cls = <class 'pytest_factoryboy.fixture.model_fixture.<locals>.Factory'>, args = (), kwargs = {'create': True, 'extra': {'attributes': None}}

    @classmethod
    def attributes(cls, *args, **kwargs):
        return dict(
            (key, value)
>           for key, value in super(Factory, cls).attributes(*args, **kwargs).items()
            if key in data
        )
E       TypeError: 'NoneType' object is not callable

Factory    = <class 'pytest_factoryboy.fixture.model_fixture.<locals>.Factory'>
__class__  = <class 'pytest_factoryboy.fixture.model_fixture.<locals>.Factory'>
args       = ()
cls        = <class 'pytest_factoryboy.fixture.model_fixture.<locals>.Factory'>
data       = {'attributes': None}
kwargs     = {'create': True, 'extra': {'attributes': None}}

.tox/py36-pytest3/lib/python3.6/site-packages/pytest_factoryboy/fixture.py:184: TypeError
```
  • Loading branch information
blueyed authored and olegpidsadnyi committed Jan 30, 2018
1 parent 2c866a5 commit 85f3960
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/test_attributes_field.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from pytest_factoryboy import register
import factory


class EmptyModel(object):
pass


class AttributesFactory(factory.Factory):
class Meta:
model = EmptyModel

attributes = None


register(AttributesFactory, "with_attributes")


def test_factory_with_attributes(with_attributes):
"""Test that a factory can have a `attributes` field."""
pass

0 comments on commit 85f3960

Please sign in to comment.