diff options
author | Raphaël Barrois <raphael.barrois@polytechnique.org> | 2014-11-18 00:35:19 +0100 |
---|---|---|
committer | Raphaël Barrois <raphael.barrois@polytechnique.org> | 2014-11-18 00:39:52 +0100 |
commit | 336ea5ac8b2d922fb54f99edd55d4773dd126934 (patch) | |
tree | f46ee3cbbd9f1d6ab4ad4af122b66371cdc2eb85 /factory | |
parent | 13d310fa14f4e4b9a559f8b7887f2a2492357013 (diff) | |
download | factory-boy-336ea5ac8b2d922fb54f99edd55d4773dd126934.tar factory-boy-336ea5ac8b2d922fb54f99edd55d4773dd126934.tar.gz |
Remove deprecated features.
This disables the ``FACTORY_FOR`` syntax and related parameters,
that should be declared through ``class Meta``.
Diffstat (limited to 'factory')
-rw-r--r-- | factory/alchemy.py | 5 | ||||
-rw-r--r-- | factory/base.py | 26 | ||||
-rw-r--r-- | factory/declarations.py | 9 | ||||
-rw-r--r-- | factory/django.py | 5 | ||||
-rw-r--r-- | factory/helpers.py | 1 |
5 files changed, 0 insertions, 46 deletions
diff --git a/factory/alchemy.py b/factory/alchemy.py index 2cd28bb..6408393 100644 --- a/factory/alchemy.py +++ b/factory/alchemy.py @@ -38,11 +38,6 @@ class SQLAlchemyModelFactory(base.Factory): class Meta: abstract = True - _OLDSTYLE_ATTRIBUTES = base.Factory._OLDSTYLE_ATTRIBUTES.copy() - _OLDSTYLE_ATTRIBUTES.update({ - 'FACTORY_SESSION': 'sqlalchemy_session', - }) - @classmethod def _create(cls, model_class, *args, **kwargs): """Create an instance of the model, and save it to the database.""" diff --git a/factory/base.py b/factory/base.py index 9e07899..efff976 100644 --- a/factory/base.py +++ b/factory/base.py @@ -21,7 +21,6 @@ # THE SOFTWARE. import logging -import warnings from . import containers from . import declarations @@ -109,23 +108,6 @@ class FactoryMetaClass(type): attrs_meta = attrs.pop('Meta', None) - oldstyle_attrs = {} - converted_attrs = {} - for old_name, new_name in base_factory._OLDSTYLE_ATTRIBUTES.items(): - if old_name in attrs: - oldstyle_attrs[old_name] = new_name - converted_attrs[new_name] = attrs.pop(old_name) - if oldstyle_attrs: - warnings.warn( - "Declaring any of %s at class-level is deprecated" - " and will be removed in the future. Please set them" - " as %s attributes of a 'class Meta' attribute." % ( - ', '.join(oldstyle_attrs.keys()), - ', '.join(oldstyle_attrs.values()), - ), - PendingDeprecationWarning, 2) - attrs_meta = type('Meta', (object,), converted_attrs) - base_meta = resolve_attribute('_meta', bases) options_class = resolve_attribute('_options_class', bases, FactoryOptions) @@ -322,14 +304,6 @@ class BaseFactory(object): _meta = FactoryOptions() - _OLDSTYLE_ATTRIBUTES = { - 'FACTORY_FOR': 'model', - 'ABSTRACT_FACTORY': 'abstract', - 'FACTORY_STRATEGY': 'strategy', - 'FACTORY_ARG_PARAMETERS': 'inline_args', - 'FACTORY_HIDDEN_ARGS': 'exclude', - } - # ID to use for the next 'declarations.Sequence' attribute. _counter = None diff --git a/factory/declarations.py b/factory/declarations.py index 5e7e734..f6f5846 100644 --- a/factory/declarations.py +++ b/factory/declarations.py @@ -22,7 +22,6 @@ import itertools -import warnings import logging from . import compat @@ -502,14 +501,6 @@ class RelatedFactory(PostGenerationDeclaration): def __init__(self, factory, factory_related_name='', **defaults): super(RelatedFactory, self).__init__() - if factory_related_name == '' and defaults.get('name') is not None: - warnings.warn( - "Usage of RelatedFactory(SomeFactory, name='foo') is deprecated" - " and will be removed in the future. Please use the" - " RelatedFactory(SomeFactory, 'foo') or" - " RelatedFactory(SomeFactory, factory_related_name='foo')" - " syntax instead", PendingDeprecationWarning, 2) - factory_related_name = defaults.pop('name') self.name = factory_related_name self.defaults = defaults diff --git a/factory/django.py b/factory/django.py index c58a6e2..7050366 100644 --- a/factory/django.py +++ b/factory/django.py @@ -84,11 +84,6 @@ class DjangoModelFactory(base.Factory): class Meta: abstract = True # Optional, but explicit. - _OLDSTYLE_ATTRIBUTES = base.Factory._OLDSTYLE_ATTRIBUTES.copy() - _OLDSTYLE_ATTRIBUTES.update({ - 'FACTORY_DJANGO_GET_OR_CREATE': 'django_get_or_create', - }) - @classmethod def _load_model_class(cls, definition): diff --git a/factory/helpers.py b/factory/helpers.py index 19431df..b9cef6e 100644 --- a/factory/helpers.py +++ b/factory/helpers.py @@ -28,7 +28,6 @@ import logging from . import base from . import declarations -from . import django @contextlib.contextmanager |