From 58a4b15f459369604b1c50d3edaf701eff1e8f91 Mon Sep 17 00:00:00 2001 From: Roman Mogylatov Date: Fri, 5 Mar 2021 20:08:15 -0500 Subject: [PATCH] Remove unittest2 framework --- Makefile | 4 ++-- requirements-dev.txt | 1 - .../unit/containers/test_declarative_py2_py3.py | 2 +- .../test_dynamic_async_resources_py36.py | 2 +- tests/unit/containers/test_dynamic_py2_py3.py | 2 +- tests/unit/ext/test_flask_py2_py3.py | 2 +- tests/unit/providers/test_base_py2_py3.py | 2 +- tests/unit/providers/test_callables_py2_py3.py | 2 +- .../providers/test_configuration_py2_py3.py | 2 +- tests/unit/providers/test_container_py2_py3.py | 2 +- tests/unit/providers/test_coroutines_py35.py | 2 +- tests/unit/providers/test_dict_py2_py3.py | 2 +- tests/unit/providers/test_factories_py2_py3.py | 2 +- tests/unit/providers/test_injections_py2_py3.py | 2 +- tests/unit/providers/test_list_py2_py3.py | 2 +- .../providers/test_provided_instance_py2_py3.py | 2 +- tests/unit/providers/test_resource_py35.py | 2 +- tests/unit/providers/test_selector_py2_py3.py | 2 +- tests/unit/providers/test_singletons_py2_py3.py | 2 +- tests/unit/providers/test_utils_py2_py3.py | 2 +- tests/unit/test_common_py2_py3.py | 2 +- tox.ini | 17 ++++++----------- 22 files changed, 27 insertions(+), 33 deletions(-) diff --git a/Makefile b/Makefile index b2669af0..a7ef1e43 100644 --- a/Makefile +++ b/Makefile @@ -48,14 +48,14 @@ uninstall: test-py2: build # Unit tests with coverage report coverage erase - coverage run --rcfile=./.coveragerc -m unittest2 discover -s tests/unit/ -p test_*_py2_py3.py + coverage run --rcfile=./.coveragerc -m unittest discover -s tests/unit/ -p test_*_py2_py3.py coverage report --rcfile=./.coveragerc coverage html --rcfile=./.coveragerc test: build # Unit tests with coverage report coverage erase - coverage run --rcfile=./.coveragerc -m unittest2 discover -s tests/unit/ -p test_*py3*.py + coverage run --rcfile=./.coveragerc -m unittest discover -s tests/unit/ -p test_*py3*.py coverage report --rcfile=./.coveragerc coverage html --rcfile=./.coveragerc diff --git a/requirements-dev.txt b/requirements-dev.txt index 4ae422ed..062b9272 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,6 +1,5 @@ cython==0.29.21 tox -unittest2 coverage flake8 pydocstyle diff --git a/tests/unit/containers/test_declarative_py2_py3.py b/tests/unit/containers/test_declarative_py2_py3.py index 71184713..a25ed8ce 100644 --- a/tests/unit/containers/test_declarative_py2_py3.py +++ b/tests/unit/containers/test_declarative_py2_py3.py @@ -1,7 +1,7 @@ """Dependency injector declarative container unit tests.""" import collections -import unittest2 as unittest +import unittest from dependency_injector import ( containers, diff --git a/tests/unit/containers/test_dynamic_async_resources_py36.py b/tests/unit/containers/test_dynamic_async_resources_py36.py index f11d0cd8..5053c2a2 100644 --- a/tests/unit/containers/test_dynamic_async_resources_py36.py +++ b/tests/unit/containers/test_dynamic_async_resources_py36.py @@ -1,6 +1,6 @@ """Dependency injector dynamic container unit tests for async resources.""" -import unittest2 as unittest +import unittest # Runtime import to get asyncutils module import os diff --git a/tests/unit/containers/test_dynamic_py2_py3.py b/tests/unit/containers/test_dynamic_py2_py3.py index fb794db7..efa816d7 100644 --- a/tests/unit/containers/test_dynamic_py2_py3.py +++ b/tests/unit/containers/test_dynamic_py2_py3.py @@ -1,6 +1,6 @@ """Dependency injector dynamic container unit tests.""" -import unittest2 as unittest +import unittest from dependency_injector import ( containers, diff --git a/tests/unit/ext/test_flask_py2_py3.py b/tests/unit/ext/test_flask_py2_py3.py index 49cf3d5f..fcd1c526 100644 --- a/tests/unit/ext/test_flask_py2_py3.py +++ b/tests/unit/ext/test_flask_py2_py3.py @@ -1,6 +1,6 @@ """Dependency injector Flask extension unit tests.""" -import unittest2 as unittest +import unittest from flask import Flask, url_for from flask.views import MethodView diff --git a/tests/unit/providers/test_base_py2_py3.py b/tests/unit/providers/test_base_py2_py3.py index b2978a88..83ac61b5 100644 --- a/tests/unit/providers/test_base_py2_py3.py +++ b/tests/unit/providers/test_base_py2_py3.py @@ -1,6 +1,6 @@ """Dependency injector base providers unit tests.""" -import unittest2 as unittest +import unittest from dependency_injector import ( containers, diff --git a/tests/unit/providers/test_callables_py2_py3.py b/tests/unit/providers/test_callables_py2_py3.py index dcee8478..d24fd6eb 100644 --- a/tests/unit/providers/test_callables_py2_py3.py +++ b/tests/unit/providers/test_callables_py2_py3.py @@ -2,7 +2,7 @@ import sys -import unittest2 as unittest +import unittest from dependency_injector import ( providers, diff --git a/tests/unit/providers/test_configuration_py2_py3.py b/tests/unit/providers/test_configuration_py2_py3.py index 21837ab6..bb92fbab 100644 --- a/tests/unit/providers/test_configuration_py2_py3.py +++ b/tests/unit/providers/test_configuration_py2_py3.py @@ -6,7 +6,7 @@ import os import sys import tempfile -import unittest2 as unittest +import unittest from dependency_injector import containers, providers, errors try: diff --git a/tests/unit/providers/test_container_py2_py3.py b/tests/unit/providers/test_container_py2_py3.py index 15ba3303..b31caeb4 100644 --- a/tests/unit/providers/test_container_py2_py3.py +++ b/tests/unit/providers/test_container_py2_py3.py @@ -2,7 +2,7 @@ import copy -import unittest2 as unittest +import unittest from dependency_injector import containers, providers, errors diff --git a/tests/unit/providers/test_coroutines_py35.py b/tests/unit/providers/test_coroutines_py35.py index b0dbf491..c19a58c9 100644 --- a/tests/unit/providers/test_coroutines_py35.py +++ b/tests/unit/providers/test_coroutines_py35.py @@ -2,7 +2,7 @@ import asyncio -import unittest2 as unittest +import unittest from dependency_injector import ( providers, diff --git a/tests/unit/providers/test_dict_py2_py3.py b/tests/unit/providers/test_dict_py2_py3.py index 06aae22d..d3e163c6 100644 --- a/tests/unit/providers/test_dict_py2_py3.py +++ b/tests/unit/providers/test_dict_py2_py3.py @@ -2,7 +2,7 @@ import sys -import unittest2 as unittest +import unittest from dependency_injector import providers diff --git a/tests/unit/providers/test_factories_py2_py3.py b/tests/unit/providers/test_factories_py2_py3.py index edf7de07..1a6a82e5 100644 --- a/tests/unit/providers/test_factories_py2_py3.py +++ b/tests/unit/providers/test_factories_py2_py3.py @@ -2,7 +2,7 @@ import sys -import unittest2 as unittest +import unittest from dependency_injector import ( providers, diff --git a/tests/unit/providers/test_injections_py2_py3.py b/tests/unit/providers/test_injections_py2_py3.py index dacd4714..a1e2608b 100644 --- a/tests/unit/providers/test_injections_py2_py3.py +++ b/tests/unit/providers/test_injections_py2_py3.py @@ -1,6 +1,6 @@ """Dependency injector injections unit tests.""" -import unittest2 as unittest +import unittest from dependency_injector import providers diff --git a/tests/unit/providers/test_list_py2_py3.py b/tests/unit/providers/test_list_py2_py3.py index e303745b..733714a1 100644 --- a/tests/unit/providers/test_list_py2_py3.py +++ b/tests/unit/providers/test_list_py2_py3.py @@ -2,7 +2,7 @@ import sys -import unittest2 as unittest +import unittest from dependency_injector import providers diff --git a/tests/unit/providers/test_provided_instance_py2_py3.py b/tests/unit/providers/test_provided_instance_py2_py3.py index 814b341b..d1e8345b 100644 --- a/tests/unit/providers/test_provided_instance_py2_py3.py +++ b/tests/unit/providers/test_provided_instance_py2_py3.py @@ -1,6 +1,6 @@ """Dependency injector provided instance provider unit tests.""" -import unittest2 as unittest +import unittest from dependency_injector import containers, providers diff --git a/tests/unit/providers/test_resource_py35.py b/tests/unit/providers/test_resource_py35.py index b0943968..b32acf17 100644 --- a/tests/unit/providers/test_resource_py35.py +++ b/tests/unit/providers/test_resource_py35.py @@ -2,7 +2,7 @@ import asyncio -import unittest2 as unittest +import unittest from dependency_injector import containers, providers, resources, errors diff --git a/tests/unit/providers/test_selector_py2_py3.py b/tests/unit/providers/test_selector_py2_py3.py index ee86bcc2..f9cd16b5 100644 --- a/tests/unit/providers/test_selector_py2_py3.py +++ b/tests/unit/providers/test_selector_py2_py3.py @@ -4,7 +4,7 @@ import functools import itertools import sys -import unittest2 as unittest +import unittest from dependency_injector import providers, errors diff --git a/tests/unit/providers/test_singletons_py2_py3.py b/tests/unit/providers/test_singletons_py2_py3.py index 23883282..24a8c73f 100644 --- a/tests/unit/providers/test_singletons_py2_py3.py +++ b/tests/unit/providers/test_singletons_py2_py3.py @@ -2,7 +2,7 @@ import sys -import unittest2 as unittest +import unittest from dependency_injector import ( providers, diff --git a/tests/unit/providers/test_utils_py2_py3.py b/tests/unit/providers/test_utils_py2_py3.py index 880e2fa5..4cebd190 100644 --- a/tests/unit/providers/test_utils_py2_py3.py +++ b/tests/unit/providers/test_utils_py2_py3.py @@ -1,6 +1,6 @@ """Dependency injector provider utils unit tests.""" -import unittest2 as unittest +import unittest from dependency_injector import ( providers, diff --git a/tests/unit/test_common_py2_py3.py b/tests/unit/test_common_py2_py3.py index 1a2d1f73..5eb70038 100644 --- a/tests/unit/test_common_py2_py3.py +++ b/tests/unit/test_common_py2_py3.py @@ -1,6 +1,6 @@ """Dependency injector common unit tests.""" -import unittest2 as unittest +import unittest from dependency_injector import __version__ diff --git a/tox.ini b/tox.ini index 1b4e28c8..b35ebac7 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,6 @@ envlist= [testenv] deps= - unittest2 # TODO: Hotfix, remove when fixed https://github.com/aio-libs/aiohttp/issues/5107 typing_extensions httpx @@ -15,7 +14,7 @@ extras= flask aiohttp commands= - unit2 discover -s tests/unit -p test_*_py3*.py + python -m unittest discover -s tests/unit -p test_*_py3*.py [testenv:coveralls] passenv = GITHUB_* COVERALLS_* @@ -28,44 +27,40 @@ deps= coveralls commands= coverage erase - coverage run --rcfile=./.coveragerc -m unittest2 discover -s tests/unit/ -p test_*_py3*.py + coverage run --rcfile=./.coveragerc -m unittest discover -s tests/unit/ -p test_*_py3*.py coverage report --rcfile=./.coveragerc coveralls [testenv:2.7] deps= - unittest2 extras= yaml flask commands= - unit2 discover -s tests/unit -p test_*_py2_py3.py + python -m unittest discover -s tests/unit -p test_*_py2_py3.py [testenv:3.4] deps= - unittest2 extras= flask commands= - unit2 discover -s tests/unit -p test_*_py3.py + python -m unittest discover -s tests/unit -p test_*_py3.py [testenv:3.5] deps= - unittest2 extras= yaml flask commands= - unit2 discover -s tests/unit -p test_*_py3.py + python -m unittest discover -s tests/unit -p test_*_py3.py [testenv:pypy2] deps= - unittest2 extras= yaml flask commands= - unit2 discover -s tests/unit -p test_*_py2_py3.py + python -m unittest discover -s tests/unit -p test_*_py2_py3.py [testenv:pylint] deps=