diff options
-rw-r--r-- | factory/base.py | 2 | ||||
-rw-r--r-- | tests/test_base.py | 9 |
2 files changed, 6 insertions, 5 deletions
diff --git a/factory/base.py b/factory/base.py index c1dbd98..8ff6151 100644 --- a/factory/base.py +++ b/factory/base.py @@ -182,7 +182,7 @@ class FactoryMetaClass(BaseFactoryMetaClass): FACTORY_CLASS_DECLARATION, associated_name, class_name, - ), PendingDeprecationWarning) + ), DeprecationWarning, 3) return getattr(factory_module, associated_name) diff --git a/tests/test_base.py b/tests/test_base.py index f8ba605..5cbb31b 100644 --- a/tests/test_base.py +++ b/tests/test_base.py @@ -176,8 +176,10 @@ class FactoryCreationTestCase(unittest.TestCase): self.assertTrue(isinstance(TestFactory.build(), TestObject)) def testAutomaticAssociatedClassDiscovery(self): - class TestObjectFactory(base.Factory): - pass + with warnings.catch_warnings(): + warnings.simplefilter('ignore') + class TestObjectFactory(base.Factory): + pass self.assertTrue(isinstance(TestObjectFactory.build(), TestObject)) @@ -186,8 +188,7 @@ class FactoryCreationTestCase(unittest.TestCase): with warnings.catch_warnings(record=True) as w: # Clear the warning registry. - if hasattr(base, '__warningregistry__'): - base.__warningregistry__.clear() + __warningregistry__.clear() warnings.simplefilter('always') class TestObjectFactory(base.Factory): |