Commit 47dcd0b9 authored by Arnaud Fontaine's avatar Arnaud Fontaine

Add further checks in testImportVersionedComponentOnly.

parent 19873b35
...@@ -1619,14 +1619,19 @@ class _TestZodbComponent(SecurityTestCase): ...@@ -1619,14 +1619,19 @@ class _TestZodbComponent(SecurityTestCase):
"""from %s.erp5_version.TestImportedVersionedComponentOnly import foo """from %s.erp5_version.TestImportedVersionedComponentOnly import foo
def bar(*args, **kwargs): def bar(*args, **kwargs):
return foo(*args, **kwargs) return 'Bar' + foo(*args, **kwargs)
""" % top_module_name) """ % top_module_name)
component_import.validate() component_import.validate()
transaction.commit() transaction.commit()
self.tic() self.tic()
# Versioned package and its alias must be available
self.assertModuleImportable('TestImportVersionedComponentOnly') self.assertModuleImportable('TestImportVersionedComponentOnly')
self.assertModuleImportable('erp5_version.TestImportVersionedComponentOnly')
# Versioned Component of imported Component must be importable and check
# later that the module has not been added to the top-level package
self.assertModuleImportable('erp5_version.TestImportedVersionedComponentOnly') self.assertModuleImportable('erp5_version.TestImportedVersionedComponentOnly')
top_module = __import__(top_module_name, level=0, top_module = __import__(top_module_name, level=0,
...@@ -1644,6 +1649,13 @@ def bar(*args, **kwargs): ...@@ -1644,6 +1649,13 @@ def bar(*args, **kwargs):
# only the versioned Component has been used # only the versioned Component has been used
self.failIfHasAttribute(top_module, 'TestImportedVersionedComponentOnly') self.failIfHasAttribute(top_module, 'TestImportedVersionedComponentOnly')
# As well as functions defined on unversioned Component
self.assertHasAttribute(top_module.TestImportVersionedComponentOnly, 'bar')
self.assertEquals(
top_module.TestImportVersionedComponentOnly.bar(),
'BarTestImportedVersionedComponentOnly')
def testVersionPriority(self): def testVersionPriority(self):
""" """
Check whether Version priorities properly works by adding and removing Check whether Version priorities properly works by adding and removing
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment