Esempio n. 1
0
 def test_all(self):
     # Check that __all__ is present and does not contain invalid entries
     self.skipIfNoAll()
     names = {}
     six.exec_("from %s import *" % self.modname, names)
     names.pop('__builtins__', None)
     self.assertEqual(sorted(names), sorted(self.module.__all__))
Esempio n. 2
0
 def check_all(self):
     # Check that __all__ is present and does not contain invalid entries
     if not hasattr(self.module, '__all__'):
         self.assertIn(self.modname, NO_ALL)
         return
     names = {}
     six.exec_("from %s import *" % self.modname, names)
     names.pop('__builtins__', None)
     self.assertEqual(sorted(names), sorted(self.module.__all__))
Esempio n. 3
0
 def check_all(self):
     # Check that __all__ is present and does not contain invalid entries
     if not hasattr(self.module, '__all__'):
         self.assertIn(self.modname, NO_ALL)
         return
     names = {}
     six.exec_("from %s import *" % self.modname, names)
     names.pop('__builtins__', None)
     self.assertEqual(sorted(names), sorted(self.module.__all__))
Esempio n. 4
0
 def test(_):
     with open(path, 'rb') as f:
         src = f.read()
     with warnings.catch_warnings():
         warnings.simplefilter('ignore', DeprecationWarning)
         try:
             six.exec_(src, {'__file__': path})
         except ImportError:
             if module in modules.OPTIONAL_MODULES:
                 raise unittest.SkipTest("Unable to import optional module %s" % module)
             raise
 def test(_):
     with open(path, 'rb') as f:
         src = f.read()
     with warnings.catch_warnings():
         warnings.simplefilter('ignore', DeprecationWarning)
         try:
             six.exec_(src, {'__file__': path, '__name__': module})
         except ImportError:
             if module in modules.OPTIONAL_MODULES:
                 raise unittest.SkipTest("Unable to import optional module %s" % module)
             raise
Esempio n. 6
0
    def test_all(self):
        # Check that __all__ is present in the gevent module,
        # and only includes things that actually exist and can be
        # imported from it.
        self.skipIfNoAll()
        names = {}
        six.exec_("from %s import *" % self.modname, names)
        names.pop('__builtins__', None)
        self.maxDiff = None

        # It should match both as a set
        self.assertEqual(set(names), set(self.module.__all__))
        # and it should not contain duplicates.
        self.assertEqual(sorted(names), sorted(self.module.__all__))
Esempio n. 7
0
 def test(_):
     with open(path, 'rb') as f:
         src = f.read()
     with warnings.catch_warnings():
         warnings.simplefilter('ignore', DeprecationWarning)
         six.exec_(src, {'__file__': path})