Commit e6294197 authored by Jason Madden's avatar Jason Madden

Fix test__execmodules on windows

parent 23c5ee4a
from gevent._fileobjectposix import FileObjectPosix
__all__ = ['FileObjectPosix', ]
try:
from gevent._fileobjectposix import FileObjectPosix
__all__ = ['FileObjectPosix', ]
except ImportError:
import sys
assert sys.platform.startswith('win'), "Should be able to import except on Windows"
__all__ = []
......@@ -475,7 +475,7 @@ if hasattr(_socket, 'socketpair'):
one._drop()
two._drop()
return result
else:
elif 'socketpair' in __implements__:
__implements__.remove('socketpair')
if hasattr(_socket, 'fromfd'):
......@@ -487,7 +487,7 @@ if hasattr(_socket, 'fromfd'):
s._drop()
return result
else:
elif 'fromfd' in __implements__:
__implements__.remove('fromfd')
if hasattr(__socket__, 'ssl'):
......
......@@ -48,6 +48,29 @@ else:
gettotalrefcount = getattr(sys, 'gettotalrefcount', None)
OPTIONAL_MODULES = ['resolver_ares']
# Generally, ignore the portions that are only implemented
# on particular platforms; they generally contain partial
# implementations completed in different modules.
PLATFORM_SPECIFIC_SUFFIXES = ['2', '279', '3']
if sys.platform.startswith('win'):
PLATFORM_SPECIFIC_SUFFIXES.append('posix')
NON_APPLICABLE_SUFFIXES = []
if sys.version_info[0] == 3:
# Python 3
NON_APPLICABLE_SUFFIXES.extend(('2', '279'))
if sys.version_info[0] == 2:
# Any python 2
NON_APPLICABLE_SUFFIXES.append('3')
if (sys.version_info[1] < 7
or (sys.version_info[1] == 7 and sys.version_info[2] < 9)):
# Python 2, < 2.7.9
NON_APPLICABLE_SUFFIXES.append('279')
if sys.platform.startswith('win'):
NON_APPLICABLE_SUFFIXES.append("posix")
# This is intimately tied to FileObjectPosix
NON_APPLICABLE_SUFFIXES.append("fileobject2")
class ExpectedException(Exception):
"""An exception whose traceback should be ignored"""
......
......@@ -5,6 +5,7 @@ import sys
import unittest
import types
from greentest import walk_modules
from greentest import PLATFORM_SPECIFIC_SUFFIXES
MAPPING = {
......@@ -162,13 +163,7 @@ are missing from %r:
raise AssertionError(msg)
def _test(self, modname):
# Generally, ignore the portions that are only implemented
# on particular platforms; they generally contain partial
# implementations completed in different modules.
ignored_suffixes = ['2', '279', '3']
if sys.platform.startswith('win'):
ignored_suffixes.append('posix')
for x in ignored_suffixes:
for x in PLATFORM_SPECIFIC_SUFFIXES:
if modname.endswith(x):
return
......
import sys
from gevent.hub import PYGTE279
from greentest import walk_modules, BaseTestCase, main
from greentest import walk_modules, BaseTestCase, main, NON_APPLICABLE_SUFFIXES
import six
......@@ -22,12 +22,14 @@ def make_exec_test(path, module):
for path, module in walk_modules():
if sys.version_info[0] == 3 and path.endswith('2.py'):
continue
if sys.version_info[0] == 2 and path.endswith('3.py'):
continue
if not PYGTE279 and path.endswith('279.py'):
ignored = False
for x in NON_APPLICABLE_SUFFIXES:
if module.endswith(x):
ignored = True
break
if ignored:
continue
make_exec_test(path, module)
......
......@@ -55,7 +55,6 @@ if sys.platform == 'win32':
# fork watchers don't get called in multithreaded programs on windows
# No idea why.
'test__core_fork.py',
'test__execmodules.py',
'FLAKY test__greenletset.py',
# The various timeout tests are flaky for unknown reasons
# on appveyor
......
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