You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
172 lines
5.0 KiB
Python
172 lines
5.0 KiB
Python
# Copyright (c) 2008-2009 AG Projects
|
|
# Copyright 2018 gevent community
|
|
# Author: Denis Bilenko
|
|
#
|
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
# of this software and associated documentation files (the "Software"), to deal
|
|
# in the Software without restriction, including without limitation the rights
|
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
# copies of the Software, and to permit persons to whom the Software is
|
|
# furnished to do so, subject to the following conditions:
|
|
#
|
|
# The above copyright notice and this permission notice shall be included in
|
|
# all copies or substantial portions of the Software.
|
|
#
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
# THE SOFTWARE.
|
|
|
|
|
|
import unittest
|
|
|
|
# pylint:disable=unused-import
|
|
|
|
# It's important to do this ASAP, because if we're monkey patched,
|
|
# then importing things like the standard library test.support can
|
|
# need to construct the hub (to check for IPv6 support using a socket).
|
|
from .hub import QuietHub
|
|
import gevent.hub
|
|
gevent.hub.set_default_hub_class(QuietHub)
|
|
|
|
from .sysinfo import VERBOSE
|
|
from .sysinfo import WIN
|
|
from .sysinfo import LINUX
|
|
from .sysinfo import LIBUV
|
|
from .sysinfo import CFFI_BACKEND
|
|
from .sysinfo import DEBUG
|
|
from .sysinfo import RUN_LEAKCHECKS
|
|
from .sysinfo import RUN_COVERAGE
|
|
|
|
from .sysinfo import PY2
|
|
from .sysinfo import PY3
|
|
from .sysinfo import PY36
|
|
from .sysinfo import PY37
|
|
|
|
from .sysinfo import PYPY
|
|
from .sysinfo import PYPY3
|
|
from .sysinfo import CPYTHON
|
|
|
|
from .sysinfo import PLATFORM_SPECIFIC_SUFFIXES
|
|
from .sysinfo import NON_APPLICABLE_SUFFIXES
|
|
from .sysinfo import SHARED_OBJECT_EXTENSION
|
|
|
|
from .sysinfo import RUNNING_ON_TRAVIS
|
|
from .sysinfo import RUNNING_ON_APPVEYOR
|
|
from .sysinfo import RUNNING_ON_CI
|
|
|
|
from .sysinfo import RESOLVER_NOT_SYSTEM
|
|
from .sysinfo import RESOLVER_DNSPYTHON
|
|
from .sysinfo import RESOLVER_ARES
|
|
|
|
from .sysinfo import EXPECT_POOR_TIMER_RESOLUTION
|
|
|
|
from .sysinfo import CONN_ABORTED_ERRORS
|
|
|
|
from .skipping import skipOnWindows
|
|
from .skipping import skipOnAppVeyor
|
|
from .skipping import skipOnCI
|
|
from .skipping import skipOnPyPy3OnCI
|
|
from .skipping import skipOnPyPy
|
|
from .skipping import skipOnPyPyOnCI
|
|
from .skipping import skipOnPyPy3
|
|
from .skipping import skipIf
|
|
from .skipping import skipUnless
|
|
from .skipping import skipOnLibev
|
|
from .skipping import skipOnLibuv
|
|
from .skipping import skipOnLibuvOnWin
|
|
from .skipping import skipOnLibuvOnCI
|
|
from .skipping import skipOnLibuvOnCIOnPyPy
|
|
from .skipping import skipOnLibuvOnPyPyOnWin
|
|
from .skipping import skipOnPurePython
|
|
from .skipping import skipWithCExtensions
|
|
from .skipping import skipOnLibuvOnTravisOnCPython27
|
|
from .skipping import skipOnPy37
|
|
from .skipping import skipOnPy3
|
|
from .skipping import skipWithoutResource
|
|
from .skipping import skipWithoutExternalNetwork
|
|
from .skipping import skipOnPy2
|
|
from .skipping import skipOnManylinux
|
|
|
|
from .exception import ExpectedException
|
|
|
|
|
|
from .leakcheck import ignores_leakcheck
|
|
|
|
|
|
from .params import LARGE_TIMEOUT
|
|
from .params import DEFAULT_LOCAL_HOST_ADDR
|
|
from .params import DEFAULT_LOCAL_HOST_ADDR6
|
|
from .params import DEFAULT_BIND_ADDR
|
|
from .params import DEFAULT_BIND_ADDR_TUPLE
|
|
from .params import DEFAULT_CONNECT_HOST
|
|
|
|
|
|
from .params import DEFAULT_SOCKET_TIMEOUT
|
|
from .params import DEFAULT_XPC_SOCKET_TIMEOUT
|
|
|
|
main = unittest.main
|
|
SkipTest = unittest.SkipTest
|
|
|
|
|
|
|
|
|
|
from .sockets import bind_and_listen
|
|
from .sockets import tcp_listener
|
|
|
|
from .openfiles import get_number_open_files
|
|
from .openfiles import get_open_files
|
|
|
|
from .testcase import TestCase
|
|
|
|
from .modules import walk_modules
|
|
|
|
BaseTestCase = unittest.TestCase
|
|
|
|
from .flaky import reraiseFlakyTestTimeout
|
|
from .flaky import reraiseFlakyTestRaceCondition
|
|
from .flaky import reraises_flaky_timeout
|
|
from .flaky import reraises_flaky_race_condition
|
|
|
|
def gc_collect_if_needed():
|
|
"Collect garbage if necessary for destructors to run"
|
|
import gc
|
|
if PYPY: # pragma: no cover
|
|
gc.collect()
|
|
|
|
# Our usage of mock should be limited to '@mock.patch()'
|
|
# and other things that are easily...mocked...here on Python 2
|
|
# when mock is not installed.
|
|
try:
|
|
from unittest import mock
|
|
except ImportError: # Python 2
|
|
try:
|
|
import mock
|
|
except ImportError: # pragma: no cover
|
|
# Backport not installed
|
|
class mock(object):
|
|
|
|
@staticmethod
|
|
def patch(reason):
|
|
return unittest.skip(reason)
|
|
|
|
mock = mock
|
|
|
|
|
|
# zope.interface
|
|
try:
|
|
from zope.interface import verify
|
|
except ImportError:
|
|
class verify(object):
|
|
|
|
@staticmethod
|
|
def verifyObject(*_):
|
|
import warnings
|
|
warnings.warn("zope.interface is not installed; not verifying")
|
|
return
|
|
|
|
verify = verify
|