From 9351a44784eb2d884762de84b45d3c55f8cdd591 Mon Sep 17 00:00:00 2001 From: Alex Willmer Date: Sat, 11 Nov 2017 22:59:38 +0000 Subject: [PATCH] Use unittest2 in all tests This allows using features such as TestCase,assertIsInstance on Python 2.6 and earlier. --- tests/call_function_test.py | 3 ++- tests/channel_test.py | 2 +- tests/fakessh_test.py | 3 ++- tests/first_stage_test.py | 3 ++- tests/id_allocation_test.py | 2 +- tests/importer_test.py | 2 +- tests/local_test.py | 3 ++- tests/master_test.py | 5 +++-- tests/module_finder_test.py | 3 ++- tests/nested_test.py | 3 ++- tests/responder_test.py | 3 ++- tests/select_test.py | 3 ++- tests/ssh_test.py | 5 ++--- tests/testlib.py | 3 ++- tests/utils_test.py | 2 +- 15 files changed, 27 insertions(+), 18 deletions(-) diff --git a/tests/call_function_test.py b/tests/call_function_test.py index c8c390f3..853af35d 100644 --- a/tests/call_function_test.py +++ b/tests/call_function_test.py @@ -1,6 +1,7 @@ import logging import time -import unittest + +import unittest2 as unittest import mitogen.core import mitogen.master diff --git a/tests/channel_test.py b/tests/channel_test.py index fbb30345..2c6ae2be 100644 --- a/tests/channel_test.py +++ b/tests/channel_test.py @@ -1,4 +1,4 @@ -import unittest +import unittest2 as unittest import mitogen.core import testlib diff --git a/tests/fakessh_test.py b/tests/fakessh_test.py index ff9ba7b3..3b433b90 100644 --- a/tests/fakessh_test.py +++ b/tests/fakessh_test.py @@ -1,7 +1,8 @@ import os import shutil -import unittest + +import unittest2 as unittest import mitogen.fakessh diff --git a/tests/first_stage_test.py b/tests/first_stage_test.py index 4baa024b..a3dbb1d0 100644 --- a/tests/first_stage_test.py +++ b/tests/first_stage_test.py @@ -1,6 +1,7 @@ import subprocess -import unittest + +import unittest2 as unittest import mitogen.master import testlib diff --git a/tests/id_allocation_test.py b/tests/id_allocation_test.py index a65f56a4..0b32e3b3 100644 --- a/tests/id_allocation_test.py +++ b/tests/id_allocation_test.py @@ -1,5 +1,5 @@ -import unittest +import unittest2 as unittest import testlib import id_allocation diff --git a/tests/importer_test.py b/tests/importer_test.py index 3a411c06..6d5753c1 100644 --- a/tests/importer_test.py +++ b/tests/importer_test.py @@ -2,11 +2,11 @@ import email.utils import sys import types -import unittest import zlib import mock import pytest +import unittest2 as unittest import mitogen.core import testlib diff --git a/tests/local_test.py b/tests/local_test.py index ff39490a..12b8b15b 100644 --- a/tests/local_test.py +++ b/tests/local_test.py @@ -1,6 +1,7 @@ import os -import unittest + +import unittest2 as unittest import mitogen import mitogen.ssh diff --git a/tests/master_test.py b/tests/master_test.py index deb9e93a..0f56c935 100644 --- a/tests/master_test.py +++ b/tests/master_test.py @@ -1,7 +1,8 @@ import subprocess import time -import unittest + +import unittest2 as unittest import testlib import mitogen.master @@ -15,7 +16,7 @@ class ScanCodeImportsTest(unittest.TestCase): self.assertEquals(list(self.func(co)), [ (-1, 'subprocess', ()), (-1, 'time', ()), - (-1, 'unittest', ()), + (-1, 'unittest2', ()), (-1, 'testlib', ()), (-1, 'mitogen.master', ()), ]) diff --git a/tests/module_finder_test.py b/tests/module_finder_test.py index ef58fa06..b4540dd8 100644 --- a/tests/module_finder_test.py +++ b/tests/module_finder_test.py @@ -1,5 +1,6 @@ import inspect -import unittest + +import unittest2 as unittest import mitogen.master diff --git a/tests/nested_test.py b/tests/nested_test.py index 79325335..5b60a3e3 100644 --- a/tests/nested_test.py +++ b/tests/nested_test.py @@ -1,5 +1,6 @@ import os -import unittest + +import unittest2 as unittest import testlib diff --git a/tests/responder_test.py b/tests/responder_test.py index 66e451d9..bf9c64d9 100644 --- a/tests/responder_test.py +++ b/tests/responder_test.py @@ -1,9 +1,10 @@ import mock import subprocess -import unittest import sys +import unittest2 as unittest + import mitogen.master import testlib diff --git a/tests/select_test.py b/tests/select_test.py index 535b5142..44af5f47 100644 --- a/tests/select_test.py +++ b/tests/select_test.py @@ -1,5 +1,6 @@ -import unittest +import unittest2 as unittest + import mitogen.master import testlib diff --git a/tests/ssh_test.py b/tests/ssh_test.py index 91a2398e..98bc0558 100644 --- a/tests/ssh_test.py +++ b/tests/ssh_test.py @@ -1,10 +1,9 @@ - -import unittest - import mitogen import mitogen.ssh import mitogen.utils +import unittest2 as unittest + import testlib import plain_old_module diff --git a/tests/testlib.py b/tests/testlib.py index 69b61605..c56bb9d1 100644 --- a/tests/testlib.py +++ b/tests/testlib.py @@ -5,9 +5,10 @@ import re import socket import sys import time -import unittest import urlparse +import unittest2 as unittest + import mitogen.master if mitogen.is_master: # TODO: shouldn't be necessary. import docker diff --git a/tests/utils_test.py b/tests/utils_test.py index 5e96dcde..20ca4541 100644 --- a/tests/utils_test.py +++ b/tests/utils_test.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -import unittest +import unittest2 as unittest import mitogen.master import mitogen.utils