Skip to content

Commit

Permalink
Fix test__execmodules to supply the right module name.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamadden committed Aug 5, 2021
1 parent 5112e05 commit 1557a36
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/gevent/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,8 @@ def __new__(cls, *args, **kw):
else: # pragma: no cover
# Make sure we revisit in case of changes to the (accelerator) module names.
if local.__module__ != 'gevent._gevent_clocal':
raise AssertionError("Module names changed; revisit this code.")
raise AssertionError("Module names changed (local: %r; __name__: %r); revisit this code" % (
local.__module__, __name__) )

_init()

Expand Down
3 changes: 1 addition & 2 deletions src/gevent/tests/test__execmodules.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@


def make_exec_test(path, module):

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})
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)
Expand Down

0 comments on commit 1557a36

Please sign in to comment.