import sys # This is a namespace package. try: import pkg_resources pkg_resources.declare_namespace(__name__) except ImportError: # pragma: no cover import pkgutil __path__ = pkgutil.extend_path(__path__, __name__) # Put @public in builtins from public import install install() # We have to initialize the i18n subsystem before anything else happens, # however, we'll initialize it differently for tests. We have to do it this # early so that module contents is set up before anything that needs it is # imported. # # Do *not* do this if we're building the documentation. if 'build_sphinx' not in sys.argv: # pragma: no cover if any('nose2' in arg for arg in sys.argv): from mailman.testing.i18n import initialize else: from mailman.core.i18n import initialize initialize()
def test_install_py_public(self): self.assertFalse(hasattr(builtins, 'public')) self.addCleanup(delattr, builtins, 'public') install() self.assertTrue(hasattr(builtins, 'public')) self.assertIs(builtins.public, c_public or py_public)
def test_install(): try: install() finally: delattr(builtins, 'public')