diff --git a/tests/call_function_test.py b/tests/call_function_test.py index 04ecf169..cc6c32b6 100644 --- a/tests/call_function_test.py +++ b/tests/call_function_test.py @@ -1,7 +1,7 @@ import logging import time -import unittest2 as unittest +import unittest2 import mitogen.core import mitogen.master @@ -89,4 +89,4 @@ class CallFunctionTest(testlib.RouterMixin, testlib.TestCase): if __name__ == '__main__': - unittest.main() + unittest2.main() diff --git a/tests/channel_test.py b/tests/channel_test.py index d879341a..31d3f35d 100644 --- a/tests/channel_test.py +++ b/tests/channel_test.py @@ -1,4 +1,4 @@ -import unittest2 as unittest +import unittest2 import mitogen.core import testlib @@ -17,4 +17,4 @@ class ConstructorTest(testlib.RouterMixin, testlib.TestCase): if __name__ == '__main__': - unittest.main() + unittest2.main() diff --git a/tests/fakessh_test.py b/tests/fakessh_test.py index 9e37945b..6e28be1d 100644 --- a/tests/fakessh_test.py +++ b/tests/fakessh_test.py @@ -2,14 +2,14 @@ import os import shutil -import unittest2 as unittest +import unittest2 import mitogen.fakessh import testlib -class RsyncTest(testlib.DockerMixin, unittest.TestCase): +class RsyncTest(testlib.DockerMixin, unittest2.TestCase): def test_rsync_from_master(self): context = self.docker_ssh_any() @@ -60,4 +60,4 @@ class RsyncTest(testlib.DockerMixin, unittest.TestCase): if __name__ == '__main__': - unittest.main() + unittest2.main() diff --git a/tests/first_stage_test.py b/tests/first_stage_test.py index c94af2b5..d9a11956 100644 --- a/tests/first_stage_test.py +++ b/tests/first_stage_test.py @@ -1,7 +1,7 @@ import subprocess -import unittest2 as unittest +import unittest2 import mitogen.master import testlib @@ -40,4 +40,4 @@ class CommandLineTest(testlib.RouterMixin, testlib.TestCase): if __name__ == '__main__': - unittest.main() + unittest2.main() diff --git a/tests/id_allocation_test.py b/tests/id_allocation_test.py index 2dae132c..9cf36cb3 100644 --- a/tests/id_allocation_test.py +++ b/tests/id_allocation_test.py @@ -1,5 +1,5 @@ -import unittest2 as unittest +import unittest2 import testlib import id_allocation @@ -13,4 +13,4 @@ class SlaveTest(testlib.RouterMixin, testlib.TestCase): if __name__ == '__main__': - unittest.main() + unittest2.main() diff --git a/tests/importer_test.py b/tests/importer_test.py index 489e24d6..b4f742c9 100644 --- a/tests/importer_test.py +++ b/tests/importer_test.py @@ -6,7 +6,7 @@ import zlib import mock import pytest -import unittest2 as unittest +import unittest2 import mitogen.core import testlib @@ -128,4 +128,4 @@ class EmailParseAddrSysTest(testlib.RouterMixin, testlib.TestCase): if __name__ == '__main__': - unittest.main() + unittest2.main() diff --git a/tests/local_test.py b/tests/local_test.py index 12b8b15b..8ba248da 100644 --- a/tests/local_test.py +++ b/tests/local_test.py @@ -1,7 +1,7 @@ import os -import unittest2 as unittest +import unittest2 import mitogen import mitogen.ssh @@ -11,7 +11,7 @@ import testlib import plain_old_module -class LocalTest(testlib.RouterMixin, unittest.TestCase): +class LocalTest(testlib.RouterMixin, unittest2.TestCase): stream_class = mitogen.ssh.Stream def test_stream_name(self): @@ -21,4 +21,4 @@ class LocalTest(testlib.RouterMixin, unittest.TestCase): if __name__ == '__main__': - unittest.main() + unittest2.main() diff --git a/tests/master_test.py b/tests/master_test.py index 33b25565..7458f020 100644 --- a/tests/master_test.py +++ b/tests/master_test.py @@ -2,13 +2,13 @@ import subprocess import time -import unittest2 as unittest +import unittest2 import testlib import mitogen.master -class ScanCodeImportsTest(unittest.TestCase): +class ScanCodeImportsTest(unittest2.TestCase): func = staticmethod(mitogen.master.scan_code_imports) def test_simple(self): @@ -22,7 +22,7 @@ class ScanCodeImportsTest(unittest.TestCase): ]) -class IterReadTest(unittest.TestCase): +class IterReadTest(unittest2.TestCase): func = staticmethod(mitogen.master.iter_read) def make_proc(self): @@ -74,7 +74,7 @@ class IterReadTest(unittest.TestCase): proc.terminate() -class WriteAllTest(unittest.TestCase): +class WriteAllTest(unittest2.TestCase): func = staticmethod(mitogen.master.write_all) def make_proc(self): @@ -115,4 +115,4 @@ class WriteAllTest(unittest.TestCase): if __name__ == '__main__': - unittest.main() + unittest2.main() diff --git a/tests/module_finder_test.py b/tests/module_finder_test.py index 46b3a3be..1b18e748 100644 --- a/tests/module_finder_test.py +++ b/tests/module_finder_test.py @@ -1,6 +1,6 @@ import inspect -import unittest2 as unittest +import unittest2 import mitogen.master @@ -146,4 +146,4 @@ class FindRelatedImportsTest(testlib.TestCase): if __name__ == '__main__': - unittest.main() + unittest2.main() diff --git a/tests/nested_test.py b/tests/nested_test.py index 4ce58c06..c11c2e4e 100644 --- a/tests/nested_test.py +++ b/tests/nested_test.py @@ -1,6 +1,6 @@ import os -import unittest2 as unittest +import unittest2 import testlib @@ -17,4 +17,4 @@ class NestedTest(testlib.RouterMixin, testlib.TestCase): if __name__ == '__main__': - unittest.main() + unittest2.main() diff --git a/tests/responder_test.py b/tests/responder_test.py index 5891b0ca..7256cb88 100644 --- a/tests/responder_test.py +++ b/tests/responder_test.py @@ -3,7 +3,7 @@ import mock import subprocess import sys -import unittest2 as unittest +import unittest2 import mitogen.master import testlib @@ -12,7 +12,7 @@ import plain_old_module import simple_pkg.a -class GoodModulesTest(testlib.RouterMixin, unittest.TestCase): +class GoodModulesTest(testlib.RouterMixin, unittest2.TestCase): def test_plain_old_module(self): # The simplest case: a top-level module with no interesting imports or # package machinery damage. @@ -34,7 +34,7 @@ class GoodModulesTest(testlib.RouterMixin, unittest.TestCase): self.assertEquals(output, "['__main__', 50]\n") -class BrokenModulesTest(unittest.TestCase): +class BrokenModulesTest(unittest2.TestCase): def test_obviously_missing(self): # Ensure we don't crash in the case of a module legitimately being # unavailable. Should never happen in the real world. @@ -79,4 +79,4 @@ class BrokenModulesTest(unittest.TestCase): if __name__ == '__main__': - unittest.main() + unittest2.main() diff --git a/tests/select_test.py b/tests/select_test.py index 44af5f47..bf73561d 100644 --- a/tests/select_test.py +++ b/tests/select_test.py @@ -1,5 +1,5 @@ -import unittest2 as unittest +import unittest2 import mitogen.master @@ -262,4 +262,4 @@ class GetTest(testlib.RouterMixin, testlib.TestCase): if __name__ == '__main__': - unittest.main() + unittest2.main() diff --git a/tests/ssh_test.py b/tests/ssh_test.py index bdd6c825..b8114139 100644 --- a/tests/ssh_test.py +++ b/tests/ssh_test.py @@ -2,13 +2,13 @@ import mitogen import mitogen.ssh import mitogen.utils -import unittest2 as unittest +import unittest2 import testlib import plain_old_module -class FakeSshTest(testlib.RouterMixin, unittest.TestCase): +class FakeSshTest(testlib.RouterMixin, unittest2.TestCase): def test_okay(self): context = self.router.ssh( hostname='hostname', @@ -20,7 +20,7 @@ class FakeSshTest(testlib.RouterMixin, unittest.TestCase): self.assertEquals(3, context.call(plain_old_module.add, 1, 2)) -class SshTest(testlib.DockerMixin, unittest.TestCase): +class SshTest(testlib.DockerMixin, unittest2.TestCase): stream_class = mitogen.ssh.Stream def test_stream_name(self): @@ -101,4 +101,4 @@ class SshTest(testlib.DockerMixin, unittest.TestCase): if __name__ == '__main__': - unittest.main() + unittest2.main() diff --git a/tests/testlib.py b/tests/testlib.py index 29c8ab62..949b691c 100644 --- a/tests/testlib.py +++ b/tests/testlib.py @@ -7,7 +7,7 @@ import sys import time import urlparse -import unittest2 as unittest +import unittest2 import mitogen.master if mitogen.is_master: # TODO: shouldn't be necessary. @@ -114,7 +114,7 @@ def wait_for_port( % (host, port)) -class TestCase(unittest.TestCase): +class TestCase(unittest2.TestCase): def assertRaises(self, exc, func, *args, **kwargs): """Like regular assertRaises, except return the exception that was raised. Can't use context manager because tests must run on Python2.4""" diff --git a/tests/utils_test.py b/tests/utils_test.py index c9c2241b..4c2e2e0f 100644 --- a/tests/utils_test.py +++ b/tests/utils_test.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -import unittest2 as unittest +import unittest2 import mitogen.master import mitogen.utils @@ -15,7 +15,7 @@ def func(router): return router -class RunWithRouterTest(unittest.TestCase): +class RunWithRouterTest(unittest2.TestCase): # test_shutdown_on_exception # test_shutdown_on_success @@ -25,7 +25,7 @@ class RunWithRouterTest(unittest.TestCase): self.assertFalse(router.broker._thread.isAlive()) -class WithRouterTest(unittest.TestCase): +class WithRouterTest(unittest2.TestCase): def test_with_broker(self): router = func() self.assertIsInstance(router, mitogen.master.Router) @@ -33,4 +33,4 @@ class WithRouterTest(unittest.TestCase): if __name__ == '__main__': - unittest.main() + unittest2.main()