diff --git a/Makefile b/Makefile index 00f9477d..6dcf416a 100644 --- a/Makefile +++ b/Makefile @@ -42,10 +42,17 @@ install: uninstall clean cythonize uninstall: - pip uninstall -y -q dependency-injector 2> /dev/null -test: build +test-py2: build # Unit tests with coverage report 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 html --rcfile=./.coveragerc diff --git a/tests/unit/containers/test_declarative.py b/tests/unit/containers/test_declarative_py2_py3.py similarity index 100% rename from tests/unit/containers/test_declarative.py rename to tests/unit/containers/test_declarative_py2_py3.py diff --git a/tests/unit/containers/test_dynamic.py b/tests/unit/containers/test_dynamic_py2_py3.py similarity index 100% rename from tests/unit/containers/test_dynamic.py rename to tests/unit/containers/test_dynamic_py2_py3.py diff --git a/tests/unit/providers/test_base.py b/tests/unit/providers/test_base_py2_py3.py similarity index 100% rename from tests/unit/providers/test_base.py rename to tests/unit/providers/test_base_py2_py3.py diff --git a/tests/unit/providers/test_callables.py b/tests/unit/providers/test_callables_py2_py3.py similarity index 100% rename from tests/unit/providers/test_callables.py rename to tests/unit/providers/test_callables_py2_py3.py diff --git a/tests/unit/providers/test_configuration.py b/tests/unit/providers/test_configuration_py2_py3.py similarity index 100% rename from tests/unit/providers/test_configuration.py rename to tests/unit/providers/test_configuration_py2_py3.py diff --git a/tests/unit/providers/test_coroutines.py b/tests/unit/providers/test_coroutines_py3.py similarity index 99% rename from tests/unit/providers/test_coroutines.py rename to tests/unit/providers/test_coroutines_py3.py index 56db9ce0..6702171d 100644 --- a/tests/unit/providers/test_coroutines.py +++ b/tests/unit/providers/test_coroutines_py3.py @@ -18,8 +18,7 @@ if asyncio: def _example(arg1, arg2, arg3, arg4): future = asyncio.Future() future.set_result(None) - for _ in future: - yield _ + yield from future return arg1, arg2, arg3, arg4 def _run(coro): diff --git a/tests/unit/providers/test_factories.py b/tests/unit/providers/test_factories_py2_py3.py similarity index 100% rename from tests/unit/providers/test_factories.py rename to tests/unit/providers/test_factories_py2_py3.py diff --git a/tests/unit/providers/test_injections.py b/tests/unit/providers/test_injections_py2_py3.py similarity index 100% rename from tests/unit/providers/test_injections.py rename to tests/unit/providers/test_injections_py2_py3.py diff --git a/tests/unit/providers/test_singletons.py b/tests/unit/providers/test_singletons_py2_py3.py similarity index 100% rename from tests/unit/providers/test_singletons.py rename to tests/unit/providers/test_singletons_py2_py3.py diff --git a/tests/unit/providers/test_utils.py b/tests/unit/providers/test_utils_py2_py3.py similarity index 100% rename from tests/unit/providers/test_utils.py rename to tests/unit/providers/test_utils_py2_py3.py diff --git a/tests/unit/test_common.py b/tests/unit/test_common_py2_py3.py similarity index 100% rename from tests/unit/test_common.py rename to tests/unit/test_common_py2_py3.py diff --git a/tox.ini b/tox.ini index 2d4069ec..0e9ca7ff 100644 --- a/tox.ini +++ b/tox.ini @@ -6,11 +6,11 @@ envlist= deps= unittest2 commands= - unit2 discover tests/unit + unit2 discover -s tests/unit -p test_*_py3.py [testenv:coveralls] passenv=TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH DEPENDENCY_INJECTOR_DEBUG_MODE -basepython=python2.7 +basepython=python3.6 usedevelop=True deps= {[testenv]deps} @@ -19,10 +19,18 @@ deps= coveralls commands= 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 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] deps= pylint