From e8dc25b5db5b470a64cc6a89259d476269fcebb5 Mon Sep 17 00:00:00 2001 From: Raphaël Barrois Date: Sun, 3 Mar 2013 20:59:58 +0100 Subject: Get rid of the FACTORY_ABSTRACT rename. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This was just adding noise to an already complex release. Signed-off-by: Raphaël Barrois --- docs/changelog.rst | 2 -- factory/base.py | 15 +++------------ tests/test_base.py | 2 +- tests/test_using.py | 4 ++-- 4 files changed, 6 insertions(+), 17 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 2e7aaea..1e6d45b 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -39,8 +39,6 @@ The following features have been deprecated and will be removed in an upcoming r - Usage of :meth:`~factory.Factory.set_creation_function` and :meth:`~factory.Factory.set_building_function` are now deprecated - - The :attr:`~factory.Factory.ABSTRACT_FACTORY` attribute has been renamed to - :attr:`~factory.Factory.FACTORY_ABSTRACT`. - Implicit associated class discovery is no longer supported, you must set the :attr:`~factory.Factory.FACTORY_FOR` attribute on all :class:`~factory.Factory` subclasses diff --git a/factory/base.py b/factory/base.py index c8c7f06..28d7cdb 100644 --- a/factory/base.py +++ b/factory/base.py @@ -212,21 +212,12 @@ class FactoryMetaClass(BaseFactoryMetaClass): for construction of an associated class instance at a later time.""" parent_factories = get_factory_bases(bases) - if not parent_factories or attrs.get('ABSTRACT_FACTORY', False) \ - or attrs.get('FACTORY_ABSTRACT', False): + if not parent_factories or attrs.get('ABSTRACT_FACTORY', False): # If this isn't a subclass of Factory, or specifically declared # abstract, don't do anything special. if 'ABSTRACT_FACTORY' in attrs: - warnings.warn( - "The 'ABSTRACT_FACTORY' class attribute has been renamed " - "to 'FACTORY_ABSTRACT' for naming consistency, and will " - "be ignored in the future. Please upgrade class %s." % - class_name, DeprecationWarning, 2) attrs.pop('ABSTRACT_FACTORY') - if 'FACTORY_ABSTRACT' in attrs: - attrs.pop('FACTORY_ABSTRACT') - return super(FactoryMetaClass, cls).__new__(cls, class_name, bases, attrs) base = parent_factories[0] @@ -650,7 +641,7 @@ class DjangoModelFactory(Factory): handle those for non-numerical primary keys. """ - FACTORY_ABSTRACT = True + ABSTRACT_FACTORY = True @classmethod def _setup_next_sequence(cls): @@ -669,7 +660,7 @@ class DjangoModelFactory(Factory): class MogoFactory(Factory): """Factory for mogo objects.""" - FACTORY_ABSTRACT = True + ABSTRACT_FACTORY = True @classmethod def _build(cls, target_class, *args, **kwargs): diff --git a/tests/test_base.py b/tests/test_base.py index c16d536..6f16e8f 100644 --- a/tests/test_base.py +++ b/tests/test_base.py @@ -47,7 +47,7 @@ class FakeDjangoModel(object): self.id = None class FakeModelFactory(base.Factory): - FACTORY_ABSTRACT = True + ABSTRACT_FACTORY = True @classmethod def _create(cls, target_class, *args, **kwargs): diff --git a/tests/test_using.py b/tests/test_using.py index 20593f4..e5af8fb 100644 --- a/tests/test_using.py +++ b/tests/test_using.py @@ -63,7 +63,7 @@ class FakeModel(object): class FakeModelFactory(factory.Factory): - FACTORY_ABSTRACT = True + ABSTRACT_FACTORY = True @classmethod def _create(cls, target_class, *args, **kwargs): @@ -253,7 +253,7 @@ class UsingFactoryTestCase(unittest.TestCase): def test_abstract(self): class SomeAbstractFactory(factory.Factory): - FACTORY_ABSTRACT = True + ABSTRACT_FACTORY = True one = 'one' class InheritedFactory(SomeAbstractFactory): -- cgit v1.2.3