Split tests to python2 and python3

This commit is contained in:
Roman Mogylatov 2018-10-16 17:54:17 +03:00
parent 20dbeaffa6
commit 06526d9457
13 changed files with 21 additions and 7 deletions

View File

@ -42,10 +42,17 @@ install: uninstall clean cythonize
uninstall: uninstall:
- pip uninstall -y -q dependency-injector 2> /dev/null - pip uninstall -y -q dependency-injector 2> /dev/null
test: build test-py2: build
# Unit tests with coverage report # Unit tests with coverage report
coverage erase coverage erase
coverage run --rcfile=./.coveragerc -m unittest2 discover tests/unit coverage run --rcfile=./.coveragerc -m unittest2 discover -s tests/unit/ -p test_*_py2_py3.py
coverage report --rcfile=./.coveragerc
coverage html --rcfile=./.coveragerc
test-py3: build
# Unit tests with coverage report
coverage erase
coverage run --rcfile=./.coveragerc -m unittest2 discover -s tests/unit/ -p test_*py3.py
coverage report --rcfile=./.coveragerc coverage report --rcfile=./.coveragerc
coverage html --rcfile=./.coveragerc coverage html --rcfile=./.coveragerc

View File

@ -18,8 +18,7 @@ if asyncio:
def _example(arg1, arg2, arg3, arg4): def _example(arg1, arg2, arg3, arg4):
future = asyncio.Future() future = asyncio.Future()
future.set_result(None) future.set_result(None)
for _ in future: yield from future
yield _
return arg1, arg2, arg3, arg4 return arg1, arg2, arg3, arg4
def _run(coro): def _run(coro):

14
tox.ini
View File

@ -6,11 +6,11 @@ envlist=
deps= deps=
unittest2 unittest2
commands= commands=
unit2 discover tests/unit unit2 discover -s tests/unit -p test_*_py3.py
[testenv:coveralls] [testenv:coveralls]
passenv=TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH DEPENDENCY_INJECTOR_DEBUG_MODE passenv=TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH DEPENDENCY_INJECTOR_DEBUG_MODE
basepython=python2.7 basepython=python3.6
usedevelop=True usedevelop=True
deps= deps=
{[testenv]deps} {[testenv]deps}
@ -19,10 +19,18 @@ deps=
coveralls coveralls
commands= commands=
coverage erase coverage erase
coverage run --rcfile=./.coveragerc -m unittest2 discover tests/unit coverage run --rcfile=./.coveragerc -m unittest2 discover -s tests/unit/ -p test_*_py3.py
coverage report --rcfile=./.coveragerc coverage report --rcfile=./.coveragerc
coveralls coveralls
[testenv:py26]
commands=
unit2 discover -s tests/unit -p test_*_py2_py3.py
[testenv:py27]
commands=
unit2 discover -s tests/unit -p test_*_py2_py3.py
[testenv:pylint] [testenv:pylint]
deps= deps=
pylint pylint