Skip to content

Commit

Permalink
Merge 7a93454 into c939bdb
Browse files Browse the repository at this point in the history
  • Loading branch information
jamadden committed Jul 31, 2018
2 parents c939bdb + 7a93454 commit 6bc4298
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Expand Up @@ -9,6 +9,8 @@
- ``InterfaceObjectIO`` only returns an anonymous factory for ``IDict``
fields when it wants objects for the value.

- ``StandardExternalFields`` and ``StandardInternalFields`` are
deprecated aliases in ``nti.externalization.externalization``.

1.0.0a5 (2018-07-30)
====================
Expand Down
9 changes: 9 additions & 0 deletions src/nti/externalization/externalization/__init__.py
Expand Up @@ -22,6 +22,7 @@
import warnings

from zope import component
from zope import deferredimport

from nti.externalization._base_interfaces import MINIMAL_SYNTHETIC_EXTERNAL_KEYS
from nti.externalization._base_interfaces import isSyntheticKey
Expand Down Expand Up @@ -149,3 +150,11 @@ def _clean(m):
ext = list(ext)
_clean(ext)
return ext

deferredimport.initialize()
deferredimport.deprecatedFrom(
"Import from .interfaces",
"nti.externalization.interfaces",
"StandardExternalFields",
"StandardInternalFields",
)
23 changes: 23 additions & 0 deletions src/nti/externalization/tests/test_externalization.py
Expand Up @@ -686,3 +686,26 @@ class TestNoPickle(unittest.TestCase):

def test_decorator(self):
assert_does_not_pickle(DoNotPickleMe())


class TestDeprecatedImports(unittest.TestCase):

def test_SEF(self):
from nti.externalization import externalization
from nti.externalization import interfaces
import warnings

with warnings.catch_warnings(record=True):
sef = getattr(externalization, 'StandardExternalFields')

assert_that(sef, is_(same_instance(interfaces.StandardExternalFields)))

def test_SIF(self):
from nti.externalization import externalization
from nti.externalization import interfaces
import warnings

with warnings.catch_warnings(record=True):
sif = getattr(externalization, 'StandardInternalFields')

assert_that(sif, is_(same_instance(interfaces.StandardInternalFields)))

0 comments on commit 6bc4298

Please sign in to comment.