diff --git a/.ci/travis/install.sh b/.ci/travis/install.sh index 677dc4653..a31cb2d85 100755 --- a/.ci/travis/install.sh +++ b/.ci/travis/install.sh @@ -41,9 +41,7 @@ if [[ "$(uname -s)" == 'Darwin' ]]; then pyenv activate psutil fi -if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]] || [[ $PYVER == 'py26' ]]; then - pip install -U ipaddress unittest2 argparse mock==1.0.1 -elif [[ $TRAVIS_PYTHON_VERSION == '2.7' ]] || [[ $PYVER == 'py27' ]]; then +if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]] || [[ $PYVER == 'py27' ]]; then pip install -U ipaddress mock elif [[ $TRAVIS_PYTHON_VERSION == '3.2' ]] || [[ $PYVER == 'py32' ]]; then pip install -U ipaddress mock diff --git a/DEVGUIDE.rst b/DEVGUIDE.rst index c4ddc52d7..703ccf472 100644 --- a/DEVGUIDE.rst +++ b/DEVGUIDE.rst @@ -40,7 +40,7 @@ Makefile Some useful make commands:: $ make install # install - $ make setup-dev-env # install useful dev libs (pyflakes, unittest2, etc.) + $ make setup-dev-env # install useful dev libs (pyflakes, mock, etc.) $ make test # run unit tests $ make test-memleaks # run memory leak tests $ make coverage # run test coverage diff --git a/Makefile b/Makefile index 953225e3e..fdf47f6d9 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ DEPS = \ flake8 \ futures \ ipaddress \ - mock==1.0.1 \ + mock \ pep8 \ perf \ pyflakes \ @@ -22,7 +22,6 @@ DEPS = \ setuptools \ sphinx \ twine \ - unittest2 \ requests # In not in a virtualenv, add --user options for install commands. diff --git a/appveyor.yml b/appveyor.yml index af7a63192..b5d01f0a1 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -78,13 +78,11 @@ install: - "powershell .ci\\appveyor\\install.ps1" # - ps: (new-object net.webclient).DownloadFile('https://raw.github.com/pypa/pip/master/contrib/get-pip.py', 'C:/get-pip.py') - "%WITH_COMPILER% %PYTHON%/python.exe -m pip --version" - - "%WITH_COMPILER% %PYTHON%/python.exe -m pip install --upgrade --user unittest2 ipaddress pypiwin32 wmi wheel" - "%WITH_COMPILER% %PYTHON%/python.exe -m pip freeze" - "%WITH_COMPILER% %PYTHON%/python.exe setup.py build" - "%WITH_COMPILER% %PYTHON%/python.exe setup.py build build_ext -i" - "%WITH_COMPILER% %PYTHON%/python.exe setup.py develop" - # 1.0.1 is the latest release supporting python 2.6 - - "%WITH_COMPILER% %PYTHON%/Scripts/pip.exe install mock==1.0.1" + - "%WITH_COMPILER% %PYTHON%/Scripts/pip.exe install mock" build: off diff --git a/psutil/tests/__init__.py b/psutil/tests/__init__.py index 2546f98c7..e63f8e682 100644 --- a/psutil/tests/__init__.py +++ b/psutil/tests/__init__.py @@ -26,6 +26,7 @@ import textwrap import threading import time +import unittest import warnings from socket import AF_INET from socket import AF_INET6 @@ -41,11 +42,6 @@ from psutil._compat import unicode from psutil._compat import which -if sys.version_info < (2, 7): - import unittest2 as unittest # requires "pip install unittest2" -else: - import unittest - try: from unittest import mock # py3 except ImportError: diff --git a/psutil/tests/__main__.py b/psutil/tests/__main__.py index 1490e6b6e..af084499c 100755 --- a/psutil/tests/__main__.py +++ b/psutil/tests/__main__.py @@ -16,12 +16,12 @@ import ssl import sys import tempfile +import unittest try: from urllib.request import urlopen # py3 except ImportError: from urllib2 import urlopen -from psutil.tests import unittest from psutil.tests import VERBOSITY diff --git a/psutil/tests/test_bsd.py b/psutil/tests/test_bsd.py index 8fd7fe1d5..2d148140a 100755 --- a/psutil/tests/test_bsd.py +++ b/psutil/tests/test_bsd.py @@ -14,6 +14,7 @@ import os import re import time +import unittest import psutil from psutil import BSD @@ -26,7 +27,6 @@ from psutil.tests import retry_before_failing from psutil.tests import run_test_module_by_name from psutil.tests import sh -from psutil.tests import unittest from psutil.tests import which diff --git a/psutil/tests/test_connections.py b/psutil/tests/test_connections.py index c34210002..b68c87f3b 100755 --- a/psutil/tests/test_connections.py +++ b/psutil/tests/test_connections.py @@ -9,6 +9,7 @@ import os import socket import textwrap +import unittest from contextlib import closing from socket import AF_INET from socket import AF_INET6 @@ -39,7 +40,6 @@ from psutil.tests import skip_on_access_denied from psutil.tests import tcp_socketpair from psutil.tests import TESTFN -from psutil.tests import unittest from psutil.tests import unix_socket_path from psutil.tests import unix_socketpair from psutil.tests import wait_for_file diff --git a/psutil/tests/test_contracts.py b/psutil/tests/test_contracts.py index 7666f2f83..a3fd07003 100755 --- a/psutil/tests/test_contracts.py +++ b/psutil/tests/test_contracts.py @@ -14,6 +14,7 @@ import stat import time import traceback +import unittest from contextlib import closing from psutil import BSD @@ -38,7 +39,6 @@ from psutil.tests import safe_rmpath from psutil.tests import skip_on_access_denied from psutil.tests import TESTFN -from psutil.tests import unittest from psutil.tests import unix_socket_path from psutil.tests import VALID_PROC_STATUSES from psutil.tests import warn diff --git a/psutil/tests/test_linux.py b/psutil/tests/test_linux.py index 053c5f692..82a0121a9 100755 --- a/psutil/tests/test_linux.py +++ b/psutil/tests/test_linux.py @@ -21,6 +21,7 @@ import tempfile import textwrap import time +import unittest import warnings import psutil @@ -44,7 +45,6 @@ from psutil.tests import TESTFN from psutil.tests import ThreadTask from psutil.tests import TRAVIS -from psutil.tests import unittest from psutil.tests import which diff --git a/psutil/tests/test_memory_leaks.py b/psutil/tests/test_memory_leaks.py index 28a083f26..c3727763b 100755 --- a/psutil/tests/test_memory_leaks.py +++ b/psutil/tests/test_memory_leaks.py @@ -19,6 +19,7 @@ import os import threading import time +import unittest import psutil import psutil._common @@ -46,7 +47,6 @@ from psutil.tests import safe_rmpath from psutil.tests import TESTFN from psutil.tests import TRAVIS -from psutil.tests import unittest LOOPS = 1000 diff --git a/psutil/tests/test_misc.py b/psutil/tests/test_misc.py index 6bc2e28c9..e905770f2 100755 --- a/psutil/tests/test_misc.py +++ b/psutil/tests/test_misc.py @@ -20,6 +20,7 @@ import socket import stat import sys +import unittest from psutil import LINUX from psutil import POSIX @@ -57,7 +58,6 @@ from psutil.tests import TESTFN from psutil.tests import TOX from psutil.tests import TRAVIS -from psutil.tests import unittest from psutil.tests import unix_socket_path from psutil.tests import unix_socketpair from psutil.tests import wait_for_file diff --git a/psutil/tests/test_osx.py b/psutil/tests/test_osx.py index 8ba949b0a..1b9fc1349 100755 --- a/psutil/tests/test_osx.py +++ b/psutil/tests/test_osx.py @@ -9,6 +9,7 @@ import os import re import time +import unittest import psutil from psutil import OSX @@ -18,7 +19,6 @@ from psutil.tests import retry_before_failing from psutil.tests import run_test_module_by_name from psutil.tests import sh -from psutil.tests import unittest PAGESIZE = os.sysconf("SC_PAGE_SIZE") if OSX else None diff --git a/psutil/tests/test_posix.py b/psutil/tests/test_posix.py index 3274c02ca..8a1c59d85 100755 --- a/psutil/tests/test_posix.py +++ b/psutil/tests/test_posix.py @@ -13,6 +13,7 @@ import subprocess import sys import time +import unittest import psutil from psutil import BSD @@ -34,7 +35,6 @@ from psutil.tests import sh from psutil.tests import skip_on_access_denied from psutil.tests import TRAVIS -from psutil.tests import unittest from psutil.tests import wait_for_pid diff --git a/psutil/tests/test_process.py b/psutil/tests/test_process.py index d1cb96573..39e804c06 100755 --- a/psutil/tests/test_process.py +++ b/psutil/tests/test_process.py @@ -20,6 +20,7 @@ import textwrap import time import types +import unittest import psutil @@ -65,7 +66,6 @@ from psutil.tests import ThreadTask from psutil.tests import TOX from psutil.tests import TRAVIS -from psutil.tests import unittest from psutil.tests import wait_for_pid from psutil.tests import WIN_VISTA diff --git a/psutil/tests/test_sunos.py b/psutil/tests/test_sunos.py index ea9afcde0..995acd60d 100755 --- a/psutil/tests/test_sunos.py +++ b/psutil/tests/test_sunos.py @@ -7,12 +7,12 @@ """Sun OS specific tests.""" import os +import unittest import psutil from psutil import SUNOS from psutil.tests import run_test_module_by_name from psutil.tests import sh -from psutil.tests import unittest @unittest.skipIf(not SUNOS, "SUNOS only") diff --git a/psutil/tests/test_system.py b/psutil/tests/test_system.py index 32f76f57c..accfe83ca 100755 --- a/psutil/tests/test_system.py +++ b/psutil/tests/test_system.py @@ -17,6 +17,7 @@ import sys import tempfile import time +import unittest import psutil from psutil import BSD @@ -48,7 +49,6 @@ from psutil.tests import TESTFN from psutil.tests import TESTFN_UNICODE from psutil.tests import TRAVIS -from psutil.tests import unittest # =================================================================== diff --git a/psutil/tests/test_unicode.py b/psutil/tests/test_unicode.py index ae3c012fd..0177dfbad 100755 --- a/psutil/tests/test_unicode.py +++ b/psutil/tests/test_unicode.py @@ -53,6 +53,7 @@ """ import os +import unittest from contextlib import closing from psutil import BSD @@ -79,7 +80,6 @@ from psutil.tests import TESTFN from psutil.tests import TESTFN_UNICODE from psutil.tests import TRAVIS -from psutil.tests import unittest from psutil.tests import unix_socket_path import psutil import psutil.tests diff --git a/psutil/tests/test_windows.py b/psutil/tests/test_windows.py index ac7872837..b60a950dc 100755 --- a/psutil/tests/test_windows.py +++ b/psutil/tests/test_windows.py @@ -16,6 +16,7 @@ import subprocess import sys import time +import unittest try: import win32api # requires "pip install pypiwin32" / "make setup-dev-env" @@ -37,7 +38,6 @@ from psutil.tests import retry_before_failing from psutil.tests import run_test_module_by_name from psutil.tests import sh -from psutil.tests import unittest cext = psutil._psplatform.cext diff --git a/scripts/internal/winmake.py b/scripts/internal/winmake.py index aaeaeed56..b1c529899 100755 --- a/scripts/internal/winmake.py +++ b/scripts/internal/winmake.py @@ -40,7 +40,6 @@ "pypiwin32", "pyreadline", "setuptools", - "unittest2", "wheel", "wmi", "requests" diff --git a/setup.py b/setup.py index 0b26fc220..2ca466a2d 100755 --- a/setup.py +++ b/setup.py @@ -270,7 +270,7 @@ def main(): packages=packages, ext_modules=extensions, test_suite="psutil.tests.get_suite", - tests_require=['ipaddress', 'mock', 'unittest2'], + tests_require=['ipaddress', 'mock'], zip_safe=False, # http://stackoverflow.com/questions/19548957 # see: python setup.py register --list-classifiers classifiers=[ diff --git a/tox.ini b/tox.ini index 20b9f229d..f64125fa8 100644 --- a/tox.ini +++ b/tox.ini @@ -5,14 +5,11 @@ # directory. [tox] -envlist = py26, py27, py32, py33, py34 +envlist = py27, py32, py33, py34, py35, py36 [testenv] deps = flake8 - py26: ipaddress - py26: mock==1.0.1 - py26: unittest2 py27: ipaddress py27: mock py32: ipaddress