本文整理汇总了Python中test.test_timeout.skip_expected方法的典型用法代码示例。如果您正苦于以下问题:Python test_timeout.skip_expected方法的具体用法?Python test_timeout.skip_expected怎么用?Python test_timeout.skip_expected使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类test.test_timeout
的用法示例。
在下文中一共展示了test_timeout.skip_expected方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: skip_conditional_support
# 需要导入模块: from test import test_timeout [as 别名]
# 或者: from test.test_timeout import skip_expected [as 别名]
def skip_conditional_support(test_module,module_name):
try:
test_support.import_module(module_name)
except unittest.SkipTest:
return '\n' + test_module
return ""
# Map sys.platform to a string containing the basenames of tests
# expected to be skipped on that platform.
#
# Special cases:
# test_pep277
# The _ExpectedSkips constructor adds this to the set of expected
# skips if not os.path.supports_unicode_filenames.
# test_socket_ssl
# Controlled by test_socket_ssl.skip_expected. Requires the network
# resource, and a socket module with ssl support.
# test_timeout
# Controlled by test_timeout.skip_expected. Requires the network
# resource and a socket module.
#
# Tests that are expected to be skipped everywhere except on one platform
# are also handled separately.
示例2: printlist
# 需要导入模块: from test import test_timeout [as 别名]
# 或者: from test.test_timeout import skip_expected [as 别名]
def printlist(x, width=70, indent=4):
"""Print the elements of iterable x to stdout.
Optional arg width (default 70) is the maximum line length.
Optional arg indent (default 4) is the number of blanks with which to
begin each line.
"""
from textwrap import fill
blanks = ' ' * indent
# Print the sorted list: 'x' may be a '--random' list or a set()
print(fill(' '.join(str(elt) for elt in sorted(x)), width,
initial_indent=blanks, subsequent_indent=blanks))
# Map sys.platform to a string containing the basenames of tests
# expected to be skipped on that platform.
#
# Special cases:
# test_pep277
# The _ExpectedSkips constructor adds this to the set of expected
# skips if not os.path.supports_unicode_filenames.
# test_timeout
# Controlled by test_timeout.skip_expected. Requires the network
# resource and a socket module.
#
# Tests that are expected to be skipped everywhere except on one platform
# are also handled separately.
示例3: list_cases
# 需要导入模块: from test import test_timeout [as 别名]
# 或者: from test.test_timeout import skip_expected [as 别名]
def list_cases(testdir, selected, match_tests):
support.verbose = False
support.set_match_tests(match_tests)
save_modules = set(sys.modules)
skipped = []
for test in selected:
abstest = get_abs_module(testdir, test)
try:
suite = unittest.defaultTestLoader.loadTestsFromName(abstest)
_list_cases(suite)
except unittest.SkipTest:
skipped.append(test)
unload_test_modules(save_modules)
if skipped:
print >>sys.stderr
print >>sys.stderr, count(len(skipped), "test"), "skipped:"
printlist(skipped, file=sys.stderr)
# Map sys.platform to a string containing the basenames of tests
# expected to be skipped on that platform.
#
# Special cases:
# test_pep277
# The _ExpectedSkips constructor adds this to the set of expected
# skips if not os.path.supports_unicode_filenames.
# test_timeout
# Controlled by test_timeout.skip_expected. Requires the network
# resource and a socket module.
#
# Tests that are expected to be skipped everywhere except on one platform
# are also handled separately.
示例4: printlist
# 需要导入模块: from test import test_timeout [as 别名]
# 或者: from test.test_timeout import skip_expected [as 别名]
def printlist(x, width=70, indent=4):
"""Print the elements of iterable x to stdout.
Optional arg width (default 70) is the maximum line length.
Optional arg indent (default 4) is the number of blanks with which to
begin each line.
"""
from textwrap import fill
blanks = ' ' * indent
# Print the sorted list: 'x' may be a '--random' list or a set()
print fill(' '.join(str(elt) for elt in sorted(x)), width,
initial_indent=blanks, subsequent_indent=blanks)
# Map sys.platform to a string containing the basenames of tests
# expected to be skipped on that platform.
#
# Special cases:
# test_pep277
# The _ExpectedSkips constructor adds this to the set of expected
# skips if not os.path.supports_unicode_filenames.
# test_timeout
# Controlled by test_timeout.skip_expected. Requires the network
# resource and a socket module.
#
# Tests that are expected to be skipped everywhere except on one platform
# are also handled separately.
示例5: countsurprises
# 需要导入模块: from test import test_timeout [as 别名]
# 或者: from test.test_timeout import skip_expected [as 别名]
def countsurprises(expected, actual, action, antiaction, allran, resource_denieds):
"""returns the number of items in actual that aren't in expected."""
printlist(actual)
if not expected.isvalid():
print "Ask someone to teach regrtest.py about which tests are"
print "expected to %s on %s." % (action, sys.platform)
return 1#Surprising not to know what to expect....
good_surprise = expected.getexpected() - set(actual)
if allran and good_surprise:
print count(len(good_surprise), 'test'), antiaction, 'unexpectedly:'
printlist(good_surprise)
bad_surprise = set(actual) - expected.getexpected() - set(resource_denieds)
if bad_surprise:
print count(len(bad_surprise), action), "unexpected:"
printlist(bad_surprise)
return len(bad_surprise)
# Map sys.platform to a string containing the basenames of tests
# expected to be skipped on that platform.
#
# Special cases:
# test_pep277
# The _ExpectedSkips constructor adds this to the set of expected
# skips if not os.path.supports_unicode_filenames.
# test_socket_ssl
# Controlled by test_socket_ssl.skip_expected. Requires the network
# resource, and a socket module with ssl support.
# test_timeout
# Controlled by test_timeout.skip_expected. Requires the network
# resource and a socket module.
示例6: __init__
# 需要导入模块: from test import test_timeout [as 别名]
# 或者: from test.test_timeout import skip_expected [as 别名]
def __init__(self):
import os.path
from test import test_timeout
self.valid = False
expected = None
for item in _expectations:
if sys.platform.startswith(item[0]):
expected = item[1]
break
if expected is not None:
self.expected = set(expected.split())
# These are broken tests, for now skipped on every platform.
# XXX Fix these!
self.expected.add('test_nis')
# expected to be skipped on every platform, even Linux
if not os.path.supports_unicode_filenames:
self.expected.add('test_pep277')
# doctest, profile and cProfile tests fail when the codec for the
# fs encoding isn't built in because PyUnicode_Decode() adds two
# calls into Python.
encs = ("utf-8", "latin-1", "ascii", "mbcs", "utf-16", "utf-32")
if sys.getfilesystemencoding().lower() not in encs:
self.expected.add('test_profile')
self.expected.add('test_cProfile')
self.expected.add('test_doctest')
if test_timeout.skip_expected:
self.expected.add('test_timeout')
if sys.platform != "win32":
# test_sqlite is only reliable on Windows where the library
# is distributed with Python
WIN_ONLY = {"test_unicode_file", "test_winreg",
"test_winsound", "test_startfile",
"test_sqlite", "test_msilib"}
self.expected |= WIN_ONLY
if sys.platform != 'sunos5':
self.expected.add('test_nis')
if support.python_is_optimized():
self.expected.add("test_gdb")
self.valid = True
示例7: __init__
# 需要导入模块: from test import test_timeout [as 别名]
# 或者: from test.test_timeout import skip_expected [as 别名]
def __init__(self):
import os.path
from test import test_timeout
self.valid = False
if sys.platform in _expectations:
s = _expectations[sys.platform]
self.expected = set(s.split())
# expected to be skipped on every platform, even Linux
self.expected.add('test_linuxaudiodev')
if not os.path.supports_unicode_filenames:
self.expected.add('test_pep277')
if test_timeout.skip_expected:
self.expected.add('test_timeout')
if sys.maxint == 9223372036854775807L:
self.expected.add('test_imageop')
if sys.platform != "darwin":
MAC_ONLY = ["test_macos", "test_macostools", "test_aepack",
"test_plistlib", "test_scriptpackages",
"test_applesingle"]
for skip in MAC_ONLY:
self.expected.add(skip)
elif len(u'\0'.encode('unicode-internal')) == 4:
self.expected.add("test_macostools")
if sys.platform != "win32":
# test_sqlite is only reliable on Windows where the library
# is distributed with Python
WIN_ONLY = ["test_unicode_file", "test_winreg",
"test_winsound", "test_startfile",
"test_sqlite", "test_msilib"]
for skip in WIN_ONLY:
self.expected.add(skip)
if sys.platform != 'irix':
IRIX_ONLY = ["test_imageop", "test_al", "test_cd", "test_cl",
"test_gl", "test_imgfile"]
for skip in IRIX_ONLY:
self.expected.add(skip)
if sys.platform != 'sunos5':
self.expected.add('test_sunaudiodev')
self.expected.add('test_nis')
if not sys.py3kwarning:
self.expected.add('test_py3kwarn')
self.valid = True
示例8: __init__
# 需要导入模块: from test import test_timeout [as 别名]
# 或者: from test.test_timeout import skip_expected [as 别名]
def __init__(self):
import os.path
from test import test_socket_ssl
from test import test_timeout
self.valid = False
if _platform in _expectations:
s = _expectations[_platform]
self.expected = set(s.split())
if not os.path.supports_unicode_filenames:
self.expected.add('test_pep277')
if test_socket_ssl.skip_expected:
self.expected.add('test_socket_ssl')
if test_timeout.skip_expected:
self.expected.add('test_timeout')
if sys.maxint == 9223372036854775807L:
self.expected.add('test_rgbimg')
self.expected.add('test_imageop')
if not sys.platform in ("mac", "darwin"):
MAC_ONLY = ["test_macostools", "test_macfs", "test_aepack",
"test_plistlib", "test_scriptpackages"]
for skip in MAC_ONLY:
self.expected.add(skip)
if sys.platform != "win32":
WIN_ONLY = ["test_unicode_file", "test_winreg",
"test_winsound"]
for skip in WIN_ONLY:
self.expected.add(skip)
if test_support.is_jython:
if os._name != 'posix':
self.expected.update([
'test_grp', 'test_mhlib', 'test_posix', 'test_pwd',
'test_signal'])
if os._name != 'nt':
self.expected.add('test_nt_paths_jy')
self.valid = True