mirror of https://github.com/MagicStack/uvloop.git
Add a way to run tests on an installed version of uvloop
This commit is contained in:
parent
9dfbf0c1d7
commit
954e8db094
|
@ -8,7 +8,7 @@ PIP="/opt/python/${PYTHON_VERSION}/bin/pip"
|
|||
${PIP} install --upgrade pip wheel
|
||||
${PIP} install --upgrade setuptools
|
||||
${PIP} install -r /io/.ci/requirements.txt
|
||||
make -C /io/ PYTHON="${PYTHON}"
|
||||
make -C /io/ PYTHON="${PYTHON}" clean compile
|
||||
${PIP} wheel /io/ -w /io/dist/
|
||||
|
||||
# Bundle external shared libraries into the wheels.
|
||||
|
@ -21,5 +21,5 @@ PYTHON="/opt/python/${PYTHON_VERSION}/bin/python"
|
|||
PIP="/opt/python/${PYTHON_VERSION}/bin/pip"
|
||||
${PIP} install ${PYMODULE} --no-index -f file:///io/dist
|
||||
rm -rf /io/tests/__pycache__
|
||||
make -C /io/ PYTHON="${PYTHON}" test
|
||||
make -C /io/ PYTHON="${PYTHON}" testinstalled
|
||||
rm -rf /io/tests/__pycache__
|
||||
|
|
|
@ -62,7 +62,7 @@ elif [ "${TRAVIS_OS_NAME}" == "osx" ]; then
|
|||
|
||||
pip install ${PYMODULE} --no-index -f "file:///${_root}/dist"
|
||||
pushd / >/dev/null
|
||||
make -C "${_root}" test
|
||||
make -C "${_root}" testinstalled
|
||||
popd >/dev/null
|
||||
|
||||
_upload_wheels
|
||||
|
|
|
@ -50,7 +50,7 @@ matrix:
|
|||
dist: trusty
|
||||
sudo: false
|
||||
language: python
|
||||
python: "3.6-dev"
|
||||
python: "3.6"
|
||||
env: BUILD=tests
|
||||
|
||||
- os: linux
|
||||
|
|
8
Makefile
8
Makefile
|
@ -1,4 +1,4 @@
|
|||
.PHONY: _default clean clean-libuv distclean compile debug docs test release
|
||||
.PHONY: _default clean clean-libuv distclean compile debug docs test testinstalled release
|
||||
|
||||
|
||||
PYTHON ?= python
|
||||
|
@ -9,7 +9,7 @@ _default: compile
|
|||
|
||||
clean:
|
||||
rm -fr dist/ doc/_build/ *.egg-info uvloop/loop.*.pyd
|
||||
rm -fr build/lib.* build/temp.*
|
||||
rm -fr build/lib.* build/temp.* build/libuv
|
||||
rm -fr uvloop/*.c uvloop/*.html uvloop/*.so
|
||||
rm -fr uvloop/handles/*.html uvloop/includes/*.html
|
||||
find . -name '__pycache__' | xargs rm -rf
|
||||
|
@ -44,5 +44,9 @@ test:
|
|||
$(PYTHON) setup.py test
|
||||
|
||||
|
||||
testinstalled:
|
||||
$(PYTHON) tests/__init__.py
|
||||
|
||||
|
||||
release: distclean compile test
|
||||
$(PYTHON) setup.py sdist bdist_wheel upload
|
||||
|
|
|
@ -1,7 +1,17 @@
|
|||
import os.path
|
||||
import sys
|
||||
import unittest
|
||||
import unittest.runner
|
||||
|
||||
|
||||
def suite():
|
||||
test_loader = unittest.TestLoader()
|
||||
test_suite = test_loader.discover('.', pattern='test_*.py')
|
||||
test_suite = test_loader.discover(
|
||||
os.path.dirname(__file__), pattern='test_*.py')
|
||||
return test_suite
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
runner = unittest.runner.TextTestRunner()
|
||||
result = runner.run(suite())
|
||||
sys.exit(not result.wasSuccessful())
|
||||
|
|
|
@ -842,6 +842,9 @@ class Test_AIO_TCP(_TestTCP, tb.AIOTestCase):
|
|||
|
||||
class _TestSSL(tb.SSLTestCase):
|
||||
|
||||
ONLYCERT = tb._cert_fullname(__file__, 'ssl_cert.pem')
|
||||
ONLYKEY = tb._cert_fullname(__file__, 'ssl_key.pem')
|
||||
|
||||
def test_create_server_ssl_1(self):
|
||||
CNT = 0 # number of clients that were successful
|
||||
TOTAL_CNT = 25 # total number of clients that test will create
|
||||
|
|
|
@ -420,6 +420,9 @@ class Test_AIO_Unix(_TestUnix, tb.AIOTestCase):
|
|||
|
||||
class _TestSSL(tb.SSLTestCase):
|
||||
|
||||
ONLYCERT = tb._cert_fullname(__file__, 'ssl_cert.pem')
|
||||
ONLYKEY = tb._cert_fullname(__file__, 'ssl_key.pem')
|
||||
|
||||
def test_create_unix_server_ssl_1(self):
|
||||
CNT = 0 # number of clients that were successful
|
||||
TOTAL_CNT = 25 # total number of clients that test will create
|
||||
|
|
|
@ -133,10 +133,10 @@ class BaseTestCase(unittest.TestCase, metaclass=BaseTestCaseMeta):
|
|||
def skip_unclosed_handles_check(self):
|
||||
self._check_unclosed_resources_in_debug = False
|
||||
|
||||
def _cert_fullname(name):
|
||||
fullname = os.path.join(
|
||||
os.path.dirname(os.path.dirname(__file__)),
|
||||
'tests', 'certs', name)
|
||||
|
||||
def _cert_fullname(test_file_name, cert_file_name):
|
||||
fullname = os.path.abspath(os.path.join(
|
||||
os.path.dirname(test_file_name), 'certs', cert_file_name))
|
||||
assert os.path.isfile(fullname)
|
||||
return fullname
|
||||
|
||||
|
@ -173,9 +173,6 @@ def find_free_port(start_from=50000):
|
|||
|
||||
class SSLTestCase:
|
||||
|
||||
ONLYCERT = _cert_fullname('ssl_cert.pem')
|
||||
ONLYKEY = _cert_fullname('ssl_key.pem')
|
||||
|
||||
def _create_server_ssl_context(self, certfile, keyfile=None):
|
||||
sslcontext = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
|
||||
sslcontext.options |= ssl.OP_NO_SSLv2
|
||||
|
|
Loading…
Reference in New Issue