MOTOR-228 Run synchro test suite with Python 3.7
This commit is contained in:
parent
8360cf4c5f
commit
0d45707f7c
@ -773,11 +773,14 @@ axes:
|
||||
TOX_ENV: "py3-pymongo-master"
|
||||
# Use 3.6 for now until 3.7 is on all Evergreen distros.
|
||||
PYTHON_BINARY: "/opt/python/3.6/bin/python3"
|
||||
- id: "synchro"
|
||||
- id: "synchro27"
|
||||
variables:
|
||||
TOX_ENV: "synchro"
|
||||
# The synchro tests are configured for py27 in tox.ini.
|
||||
TOX_ENV: "synchro27"
|
||||
PYTHON_BINARY: "/opt/python/2.7/bin/python"
|
||||
- id: "synchro37"
|
||||
variables:
|
||||
TOX_ENV: "synchro37"
|
||||
PYTHON_BINARY: "/opt/python/3.7/bin/python3"
|
||||
|
||||
# Test Python only up to 3.6 on Mac, until our toolchain is updated.
|
||||
- id: tox-env-osx
|
||||
@ -853,7 +856,7 @@ buildvariants:
|
||||
# TODO: synchro needs PyMongo master's updated SSL test certs,
|
||||
# which may require Motor test suite changes.
|
||||
- os: "*"
|
||||
tox-env: ["synchro"]
|
||||
tox-env: ["synchro27", "synchro37"]
|
||||
ssl: "ssl"
|
||||
tasks:
|
||||
- ".latest"
|
||||
@ -883,7 +886,7 @@ buildvariants:
|
||||
|
||||
- matrix_name: "enterprise-auth"
|
||||
display_name: "Enterprise Auth"
|
||||
matrix_spec: {"tox-env": ["synchro"], ssl: "ssl"}
|
||||
matrix_spec: {"tox-env": ["synchro27"], ssl: "ssl"}
|
||||
run_on:
|
||||
- ubuntu1604-test
|
||||
tasks:
|
||||
|
||||
@ -24,7 +24,7 @@ if [ "$SSL" != "nossl" ]; then
|
||||
export CA_PEM="$DRIVERS_TOOLS/.evergreen/x509gen/ca.pem"
|
||||
fi
|
||||
|
||||
if [ "$TOX_ENV" = "synchro" ]; then
|
||||
if [ "$TOX_ENV" = "synchro27" -o "$TOX_ENV" = "synchro37" ]; then
|
||||
SETUP_ARGS="-- --check-exclude-patterns"
|
||||
fi
|
||||
|
||||
|
||||
@ -108,5 +108,6 @@ synchronous and Motor is async; how can Motor pass PyMongo's tests?
|
||||
Synchro is a hacky little module that re-synchronizes all Motor methods using
|
||||
the Tornado IOLoop's ``run_sync`` method. ``synchrotest.py`` overrides the Python
|
||||
interpreter's import machinery to allow Synchro to masquerade as PyMongo, and
|
||||
runs PyMongo's test suite against it. Use ``tox -e synchro`` to check out
|
||||
PyMongo's test suite and run it with Synchro.
|
||||
runs PyMongo's test suite against it. Use ``tox -e synchro27`` or
|
||||
``tox -e synchro37`` to check out PyMongo's test suite and run it with
|
||||
Synchro.
|
||||
|
||||
@ -674,19 +674,3 @@ class GridOut(Synchro):
|
||||
|
||||
super(GridOut, self).__setattr__(key, value)
|
||||
|
||||
|
||||
class TimeModule(object):
|
||||
"""Fake time module so time.sleep() lets other tasks run on the IOLoop.
|
||||
|
||||
See e.g. test_schedule_refresh() in test_replica_set_client.py.
|
||||
"""
|
||||
def __getattr__(self, item):
|
||||
def sleep(seconds):
|
||||
loop = IOLoop.current()
|
||||
loop.add_timeout(time.time() + seconds, loop.stop)
|
||||
loop.start()
|
||||
|
||||
if item == 'sleep':
|
||||
return sleep
|
||||
else:
|
||||
return getattr(time, item)
|
||||
|
||||
@ -306,10 +306,6 @@ if __name__ == '__main__':
|
||||
# real PyMongo.
|
||||
sys.meta_path[0:0] = [SynchroModuleFinder()]
|
||||
|
||||
# Ensure time.sleep() acts as PyMongo's tests expect: background tasks
|
||||
# can run to completion while foreground pauses.
|
||||
sys.modules['time'] = synchro.TimeModule()
|
||||
|
||||
if '--check-exclude-patterns' in sys.argv:
|
||||
check_exclude_patterns = True
|
||||
sys.argv.remove('--check-exclude-patterns')
|
||||
|
||||
27
tox.ini
27
tox.ini
@ -30,7 +30,8 @@ envlist =
|
||||
py3-pymongo-master,
|
||||
|
||||
# Apply PyMongo's test suite to Motor via Synchro.
|
||||
synchro
|
||||
synchro27,
|
||||
synchro37
|
||||
|
||||
[testenv]
|
||||
passenv =
|
||||
@ -42,11 +43,11 @@ passenv =
|
||||
ASYNC_TEST_TIMEOUT
|
||||
|
||||
basepython =
|
||||
py27,synchro: {env:PYTHON_BINARY:python2.7}
|
||||
py27,synchro27: {env:PYTHON_BINARY:python2.7}
|
||||
py34: {env:PYTHON_BINARY:python3.4}
|
||||
py35: {env:PYTHON_BINARY:python3.5}
|
||||
py36: {env:PYTHON_BINARY:python3.6}
|
||||
py37: {env:PYTHON_BINARY:python3.7}
|
||||
py37,synchro37: {env:PYTHON_BINARY:python3.7}
|
||||
pypy: {env:PYTHON_BINARY:pypy}
|
||||
pypy3: {env:PYTHON_BINARY:pypy3}
|
||||
|
||||
@ -70,9 +71,12 @@ deps =
|
||||
py3-pymongo-master: git+https://github.com/mongodb/mongo-python-driver.git
|
||||
py3-pymongo-master: tornado>=5,<6
|
||||
|
||||
synchro: tornado>=5,<6
|
||||
synchro: nose
|
||||
synchro: futures
|
||||
synchro27: tornado>=5,<6
|
||||
synchro27: nose
|
||||
synchro27: futures
|
||||
|
||||
synchro37: tornado>=6,<7
|
||||
synchro37: nose
|
||||
|
||||
commands =
|
||||
python --version
|
||||
@ -89,7 +93,7 @@ changedir = doc
|
||||
commands =
|
||||
sphinx-build -q -E -b doctest . {envtmpdir}/doctest {posargs}
|
||||
|
||||
[testenv:synchro]
|
||||
[testenv:synchro27]
|
||||
whitelist_externals =
|
||||
git
|
||||
setenv =
|
||||
@ -97,3 +101,12 @@ setenv =
|
||||
commands =
|
||||
git clone --depth 1 https://github.com/mongodb/mongo-python-driver.git {envtmpdir}/mongo-python-driver
|
||||
python -m synchro.synchrotest -v -w {envtmpdir}/mongo-python-driver {posargs}
|
||||
|
||||
[testenv:synchro37]
|
||||
whitelist_externals =
|
||||
git
|
||||
setenv =
|
||||
PYTHONPATH = {envtmpdir}/mongo-python-driver
|
||||
commands =
|
||||
git clone --depth 1 https://github.com/mongodb/mongo-python-driver.git {envtmpdir}/mongo-python-driver
|
||||
python3 -m synchro.synchrotest -v -w {envtmpdir}/mongo-python-driver {posargs}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user