Commit d658a717 authored by Ralf Schmitt's avatar Ralf Schmitt

use explicit mapping to stdlib modules in test__all__.py

the tests did bail out cause I had a threadpool module somewhere in
sys.path. better be explicit about what to test instead of relying on
the user not having installed modules with conflicting names.
parent 812fa484
...@@ -5,7 +5,12 @@ import types ...@@ -5,7 +5,12 @@ import types
from greentest import walk_modules from greentest import walk_modules
MAPPING = {'gevent.local': '_threading_local'} MAPPING = {'gevent.local': '_threading_local',
'gevent.socket': 'socket',
'gevent.select': 'select',
'gevent.ssl': 'ssl',
'gevent.thread': 'thread'}
class ANY(object): class ANY(object):
...@@ -138,12 +143,13 @@ are missing from %r: ...@@ -138,12 +143,13 @@ are missing from %r:
self.__extensions__ = getattr(self.module, '__extensions__', []) self.__extensions__ = getattr(self.module, '__extensions__', [])
self.stdlib_name = MAPPING.get(modname) self.stdlib_name = MAPPING.get(modname)
if self.stdlib_name is None: self.stdlib_module = None
self.stdlib_name = modname.replace('gevent.', '')
if self.stdlib_name is not None:
try: try:
self.stdlib_module = __import__(self.stdlib_name) self.stdlib_module = __import__(self.stdlib_name)
except ImportError: except ImportError:
self.stdlib_module = None pass
self.check_implements_presence_justified() self.check_implements_presence_justified()
...@@ -151,10 +157,6 @@ are missing from %r: ...@@ -151,10 +157,6 @@ are missing from %r:
if self.__implements__ is None: if self.__implements__ is None:
self.__implements__ = sorted(self.module.__all__) self.__implements__ = sorted(self.module.__all__)
if modname == 'gevent.greenlet':
# 'greenlet' is not a corresponding standard module for gevent.greenlet
return
if self.stdlib_module is None: if self.stdlib_module is None:
return return
......
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