tests: Remove unittest2, use stdlib unittest

unittest2 is incomplatible with Python 3.10
pull/918/head
Alex Willmer 3 years ago
parent 2a95d039ab
commit a8317c2393

@ -28,10 +28,6 @@ NOCOVERAGE="${NOCOVERAGE:-}"
NOCOVERAGE_ERASE="${NOCOVERAGE_ERASE:-$NOCOVERAGE}" NOCOVERAGE_ERASE="${NOCOVERAGE_ERASE:-$NOCOVERAGE}"
NOCOVERAGE_REPORT="${NOCOVERAGE_REPORT:-$NOCOVERAGE}" NOCOVERAGE_REPORT="${NOCOVERAGE_REPORT:-$NOCOVERAGE}"
if [ ! "$UNIT2" ]; then
UNIT2="$(which unit2)"
fi
if [ ! "$NOCOVERAGE_ERASE" ]; then if [ ! "$NOCOVERAGE_ERASE" ]; then
coverage erase coverage erase
fi fi
@ -39,12 +35,12 @@ fi
# First run overwites coverage output. # First run overwites coverage output.
[ "$SKIP_MITOGEN" ] || { [ "$SKIP_MITOGEN" ] || {
if [ ! "$NOCOVERAGE" ]; then if [ ! "$NOCOVERAGE" ]; then
coverage run -a "${UNIT2}" discover \ coverage run -a -m unittest discover \
--start-directory "tests" \ --start-directory "tests" \
--pattern '*_test.py' \ --pattern '*_test.py' \
"$@" "$@"
else else
"${UNIT2}" discover \ python -m unittest discover \
--start-directory "tests" \ --start-directory "tests" \
--pattern '*_test.py' \ --pattern '*_test.py' \
"$@" "$@"
@ -60,12 +56,12 @@ fi
[ "$SKIP_ANSIBLE" ] || { [ "$SKIP_ANSIBLE" ] || {
export PYTHONPATH=`pwd`/tests:$PYTHONPATH export PYTHONPATH=`pwd`/tests:$PYTHONPATH
if [ ! "$NOCOVERAGE" ]; then if [ ! "$NOCOVERAGE" ]; then
coverage run -a "${UNIT2}" discover \ coverage run -a -m unittest discover \
--start-directory "tests/ansible" \ --start-directory "tests/ansible" \
--pattern '*_test.py' \ --pattern '*_test.py' \
"$@" "$@"
else else
"${UNIT2}" discover \ python -m unittest discover \
--start-directory "tests/ansible" \ --start-directory "tests/ansible" \
--pattern '*_test.py' \ --pattern '*_test.py' \
"$@" "$@"

@ -7,7 +7,7 @@
__metaclass__ = type __metaclass__ = type
import inspect import inspect
import unittest2 import unittest
import ansible.template import ansible.template
@ -21,7 +21,7 @@ if 'bare_deprecated' in _argspec.args:
TEMPLATE_KWARGS['bare_deprecated'] = False TEMPLATE_KWARGS['bare_deprecated'] = False
class TestCase(unittest2.TestCase): class TestCase(unittest.TestCase):
def runTest(self): def runTest(self):
pass pass

@ -3,9 +3,8 @@ import multiprocessing
import os import os
import sys import sys
import tempfile import tempfile
import unittest
import mock
import unittest2
import testlib import testlib
import mitogen.parent import mitogen.parent
@ -18,7 +17,7 @@ class NullFixedPolicy(ansible_mitogen.affinity.FixedPolicy):
self.mask = mask self.mask = mask
@unittest2.skipIf( @unittest.skipIf(
reason='Linux only', reason='Linux only',
condition=(not os.uname()[0] == 'Linux') condition=(not os.uname()[0] == 'Linux')
) )
@ -161,7 +160,7 @@ class FixedPolicyTest(testlib.TestCase):
self.assertEquals(0x4 + 0x8, policy.mask) self.assertEquals(0x4 + 0x8, policy.mask)
@unittest2.skipIf( @unittest.skipIf(
reason='Linux/SMP only', reason='Linux/SMP only',
condition=(not ( condition=(not (
os.uname()[0] == 'Linux' and os.uname()[0] == 'Linux' and
@ -223,11 +222,7 @@ class MockLinuxPolicyTest(testlib.TestCase):
for x in range(1, 4096, 32): for x in range(1, 4096, 32):
policy.assign_subprocess() policy.assign_subprocess()
MockLinuxPolicyTest = unittest2.skipIf( MockLinuxPolicyTest = unittest.skipIf(
condition=(not sys.platform.startswith('linuxPolicy')), condition=(not sys.platform.startswith('linuxPolicy')),
reason='select.select() not supported' reason='select.select() not supported'
)(MockLinuxPolicyTest) )(MockLinuxPolicyTest)
if __name__ == '__main__':
unittest2.main()

@ -6,8 +6,6 @@ import subprocess
import tempfile import tempfile
import time import time
import unittest2
import mock import mock
import ansible.errors import ansible.errors
import ansible.playbook.play_context import ansible.playbook.play_context
@ -183,7 +181,3 @@ class PutFileTest(ConnectionMixin, testlib.TestCase):
path = tempfile.mktemp(prefix='mitotest') path = tempfile.mktemp(prefix='mitotest')
self.assertRaises(ansible.errors.AnsibleFileNotFound, self.assertRaises(ansible.errors.AnsibleFileNotFound,
lambda: self.conn.put_file(in_path='/nonexistent', out_path=path)) lambda: self.conn.put_file(in_path='/nonexistent', out_path=path))
if __name__ == '__main__':
unittest2.main()

@ -2,8 +2,6 @@ import os
import sys import sys
import tempfile import tempfile
import mock
import unittest2
import testlib import testlib
from mitogen.core import b from mitogen.core import b
@ -68,7 +66,3 @@ class WatcherTest(testlib.TestCase):
self.tf.flush() self.tf.flush()
watcher.check() watcher.check()
self.assertEqual(environb[b('SOMEKEY')], b('\xff\xff\xff')) self.assertEqual(environb[b('SOMEKEY')], b('\xff\xff\xff'))
if __name__ == '__main__':
unittest2.main()

@ -3,7 +3,7 @@ from __future__ import absolute_import
import os.path import os.path
import subprocess import subprocess
import tempfile import tempfile
import unittest2 import unittest
import mock import mock
@ -56,7 +56,7 @@ class FindGoodTempDirTest(testlib.TestCase):
class ApplyModeSpecTest(unittest2.TestCase): class ApplyModeSpecTest(unittest.TestCase):
func = staticmethod(ansible_mitogen.target.apply_mode_spec) func = staticmethod(ansible_mitogen.target.apply_mode_spec)
def test_simple(self): def test_simple(self):
@ -67,7 +67,7 @@ class ApplyModeSpecTest(unittest2.TestCase):
self.assertEquals(int('0717', 8), self.func(spec, int('0777', 8))) self.assertEquals(int('0717', 8), self.func(spec, int('0777', 8)))
class IsGoodTempDirTest(unittest2.TestCase): class IsGoodTempDirTest(unittest.TestCase):
func = staticmethod(ansible_mitogen.target.is_good_temp_dir) func = staticmethod(ansible_mitogen.target.is_good_temp_dir)
def test_creates(self): def test_creates(self):
@ -86,7 +86,7 @@ class IsGoodTempDirTest(unittest2.TestCase):
self.assertFalse(self.func(bleh)) self.assertFalse(self.func(bleh))
self.assertEquals(open(bleh).read(), 'derp') self.assertEquals(open(bleh).read(), 'derp')
@unittest2.skipIf( @unittest.skipIf(
os.geteuid() == 0, 'writes by root ignore directory permissions') os.geteuid() == 0, 'writes by root ignore directory permissions')
def test_unwriteable(self): def test_unwriteable(self):
with NamedTemporaryDirectory() as temp_path: with NamedTemporaryDirectory() as temp_path:
@ -105,8 +105,3 @@ class IsGoodTempDirTest(unittest2.TestCase):
os_access.return_value = False os_access.return_value = False
with NamedTemporaryDirectory() as temp_path: with NamedTemporaryDirectory() as temp_path:
self.assertFalse(self.func(temp_path)) self.assertFalse(self.func(temp_path))
if __name__ == '__main__':
unittest2.main()

@ -3,7 +3,6 @@ import time
import threading import threading
import mock import mock
import unittest2
import testlib import testlib
@ -67,7 +66,3 @@ class DeferSyncTest(testlib.TestCase):
finally: finally:
broker.shutdown() broker.shutdown()
broker.join() broker.join()
if __name__ == '__main__':
unittest2.main()

@ -2,8 +2,6 @@ import os
import mitogen import mitogen
import unittest2
import testlib import testlib
@ -22,7 +20,3 @@ class ConstructorTest(testlib.RouterMixin, testlib.TestCase):
self.assertEquals(argv[2], '--') self.assertEquals(argv[2], '--')
self.assertEquals(argv[3], 'container_name') self.assertEquals(argv[3], 'container_name')
self.assertEquals(argv[4], stream.conn.options.python_path) self.assertEquals(argv[4], stream.conn.options.python_path)
if __name__ == '__main__':
unittest2.main()

@ -1,8 +1,6 @@
import pickle import pickle
import sys import sys
import unittest2
import mitogen.core import mitogen.core
import testlib import testlib
@ -108,7 +106,3 @@ class PickleTest(testlib.TestCase):
e2 = pickle.loads(pickle.dumps(e)) e2 = pickle.loads(pickle.dumps(e))
self.assertTrue(e2.args[0].startswith('plain_old_module.MyError: eek')) self.assertTrue(e2.args[0].startswith('plain_old_module.MyError: eek'))
self.assertTrue('test_from_exc_tb' in e2.args[0]) self.assertTrue('test_from_exc_tb' in e2.args[0])
if __name__ == '__main__':
unittest2.main()

@ -1,8 +1,6 @@
import logging import logging
import time import time
import unittest2
import mitogen.core import mitogen.core
import mitogen.parent import mitogen.parent
import mitogen.master import mitogen.master
@ -184,7 +182,3 @@ class UnsupportedCallablesTest(testlib.RouterMixin, testlib.TestCase):
e = self.assertRaises(TypeError, e = self.assertRaises(TypeError,
lambda: self.local.call(X().x)) lambda: self.local.call(X().x))
self.assertEquals(e.args[0], self.klass.method_msg) self.assertEquals(e.args[0], self.klass.method_msg)
if __name__ == '__main__':
unittest2.main()

@ -1,5 +1,3 @@
import unittest2
import mitogen.core import mitogen.core
import testlib import testlib
@ -14,7 +12,3 @@ class ConstructorTest(testlib.RouterMixin, testlib.TestCase):
self.assertEqual(chan.dst_handle, 123) self.assertEqual(chan.dst_handle, 123)
self.assertIsNotNone(chan.handle) self.assertIsNotNone(chan.handle)
self.assertGreater(chan.handle, 0) self.assertGreater(chan.handle, 0)
if __name__ == '__main__':
unittest2.main()

@ -6,7 +6,6 @@ import tempfile
import threading import threading
import time import time
import unittest2
import testlib import testlib
import mitogen.core import mitogen.core
@ -71,7 +70,3 @@ class DetachReapTest(testlib.RouterMixin, testlib.TestCase):
# now clean up # now clean up
os.kill(pid, signal.SIGTERM) os.kill(pid, signal.SIGTERM)
os.waitpid(pid, 0) os.waitpid(pid, 0)
if __name__ == '__main__':
unittest2.main()

@ -1,6 +1,5 @@
import pickle import pickle
import unittest2
import mitogen.core import mitogen.core
from mitogen.core import b from mitogen.core import b
@ -31,7 +30,3 @@ class PickleTest(testlib.RouterMixin, testlib.TestCase):
self.assertEquals(None, c2.router) self.assertEquals(None, c2.router)
self.assertEquals(c.context_id, c2.context_id) self.assertEquals(c.context_id, c2.context_id)
self.assertEquals(c.name, c2.name) self.assertEquals(c.name, c2.name)
if __name__ == '__main__':
unittest2.main()

@ -6,8 +6,6 @@ import sys
import time import time
import tempfile import tempfile
import unittest2
import mitogen.core import mitogen.core
import mitogen.parent import mitogen.parent
from mitogen.core import b from mitogen.core import b
@ -338,7 +336,3 @@ if 0:
self.assertFalse(flags & os.O_RDWR) self.assertFalse(flags & os.O_RDWR)
self.assertTrue(info['flags'] & os.O_WRONLY) self.assertTrue(info['flags'] & os.O_WRONLY)
self.assertTrue(buf, 'TEST') self.assertTrue(buf, 'TEST')
if __name__ == '__main__':
unittest2.main()

@ -5,8 +5,6 @@ import mitogen
import mitogen.doas import mitogen.doas
import mitogen.parent import mitogen.parent
import unittest2
import testlib import testlib
@ -60,7 +58,3 @@ class ConstructorTest(testlib.RouterMixin, testlib.TestCase):
# ) # )
# context = self.router.doas(via=ssh, password='has_sudo_password') # context = self.router.doas(via=ssh, password='has_sudo_password')
# self.assertEquals(0, context.call(os.getuid)) # self.assertEquals(0, context.call(os.getuid))
if __name__ == '__main__':
unittest2.main()

@ -2,8 +2,6 @@ import os
import mitogen import mitogen
import unittest2
import testlib import testlib
@ -22,7 +20,3 @@ class ConstructorTest(testlib.RouterMixin, testlib.TestCase):
self.assertEquals(argv[2], '--interactive') self.assertEquals(argv[2], '--interactive')
self.assertEquals(argv[3], 'container_name') self.assertEquals(argv[3], 'container_name')
self.assertEquals(argv[4], stream.conn.options.python_path) self.assertEquals(argv[4], stream.conn.options.python_path)
if __name__ == '__main__':
unittest2.main()

@ -1,6 +1,3 @@
import unittest2
import testlib import testlib
import mitogen.core import mitogen.core
@ -27,7 +24,3 @@ class ConstructorTest(testlib.TestCase):
e = self.klass(mitogen.core.b('error')) e = self.klass(mitogen.core.b('error'))
self.assertEquals(e.args[0], 'error') self.assertEquals(e.args[0], 'error')
self.assertTrue(isinstance(e.args[0], mitogen.core.UnicodeType)) self.assertTrue(isinstance(e.args[0], mitogen.core.UnicodeType))
if __name__ == '__main__':
unittest2.main()

@ -1,8 +1,7 @@
import os import os
import shutil import shutil
import unittest
import unittest2
import mitogen.fakessh import mitogen.fakessh
@ -10,7 +9,7 @@ import testlib
class RsyncTest(testlib.DockerMixin, testlib.TestCase): class RsyncTest(testlib.DockerMixin, testlib.TestCase):
@unittest2.skip('broken') @unittest.skip('broken')
def test_rsync_from_master(self): def test_rsync_from_master(self):
context = self.docker_ssh_any() context = self.docker_ssh_any()
@ -26,7 +25,7 @@ class RsyncTest(testlib.DockerMixin, testlib.TestCase):
self.assertTrue(context.call(os.path.exists, '/tmp/data')) self.assertTrue(context.call(os.path.exists, '/tmp/data'))
self.assertTrue(context.call(os.path.exists, '/tmp/data/simple_pkg/a.py')) self.assertTrue(context.call(os.path.exists, '/tmp/data/simple_pkg/a.py'))
@unittest2.skip('broken') @unittest.skip('broken')
def test_rsync_between_direct_children(self): def test_rsync_between_direct_children(self):
# master -> SSH -> mitogen__has_sudo_pubkey -> rsync(.ssh) -> master -> # master -> SSH -> mitogen__has_sudo_pubkey -> rsync(.ssh) -> master ->
# mitogen__has_sudo -> rsync # mitogen__has_sudo -> rsync
@ -59,7 +58,3 @@ class RsyncTest(testlib.DockerMixin, testlib.TestCase):
pubkey_acct.call(os.path.getsize, '.ssh/authorized_keys'), pubkey_acct.call(os.path.getsize, '.ssh/authorized_keys'),
webapp_acct.call(os.path.getsize, dest_path + '/authorized_keys'), webapp_acct.call(os.path.getsize, dest_path + '/authorized_keys'),
) )
if __name__ == '__main__':
unittest2.main()

@ -1,8 +1,6 @@
import sys import sys
import unittest2
import mitogen.service import mitogen.service
import testlib import testlib
@ -148,7 +146,3 @@ class FetchTest(testlib.RouterMixin, testlib.TestCase):
expect = service.unregistered_msg % (path,) expect = service.unregistered_msg % (path,)
self.assertTrue(expect in e.args[0]) self.assertTrue(expect in e.args[0])
if __name__ == '__main__':
unittest2.main()

@ -1,8 +1,6 @@
import subprocess import subprocess
import unittest2
import mitogen.parent import mitogen.parent
from mitogen.core import b from mitogen.core import b
@ -45,7 +43,3 @@ class CommandLineTest(testlib.RouterMixin, testlib.TestCase):
self.assertIn(b("Error -5 while decompressing data"), stderr) self.assertIn(b("Error -5 while decompressing data"), stderr)
finally: finally:
fp.close() fp.close()
if __name__ == '__main__':
unittest2.main()

@ -3,6 +3,7 @@ import os
import random import random
import struct import struct
import sys import sys
import unittest
try: try:
import _ssl import _ssl
@ -21,7 +22,6 @@ except ImportError:
ctypes = None ctypes = None
import mitogen import mitogen
import unittest2
import testlib import testlib
import plain_old_module import plain_old_module
@ -78,7 +78,7 @@ def exercise_importer(n):
return simple_pkg.a.subtract_one_add_two(n) return simple_pkg.a.subtract_one_add_two(n)
skipIfUnsupported = unittest2.skipIf( skipIfUnsupported = unittest.skipIf(
condition=(not mitogen.fork.FORK_SUPPORTED), condition=(not mitogen.fork.FORK_SUPPORTED),
reason="mitogen.fork unsupported on this platform" reason="mitogen.fork unsupported on this platform"
) )
@ -94,7 +94,7 @@ class ForkTest(testlib.RouterMixin, testlib.TestCase):
context = self.router.fork() context = self.router.fork()
self.assertNotEqual(context.call(random_random), random_random()) self.assertNotEqual(context.call(random_random), random_random())
@unittest2.skipIf( @unittest.skipIf(
condition=LIBSSL_PATH is None or ctypes is None, condition=LIBSSL_PATH is None or ctypes is None,
reason='cant test libssl on this platform', reason='cant test libssl on this platform',
) )
@ -142,7 +142,3 @@ class DoubleChildTest(testlib.RouterMixin, testlib.TestCase):
self.assertEqual(2, c2.call(exercise_importer, 1)) self.assertEqual(2, c2.call(exercise_importer, 1))
DoubleChildTest = skipIfUnsupported(DoubleChildTest) DoubleChildTest = skipIfUnsupported(DoubleChildTest)
if __name__ == '__main__':
unittest2.main()

@ -1,6 +1,3 @@
import unittest2
import testlib import testlib
import mitogen.core import mitogen.core
@ -30,7 +27,3 @@ class SlaveTest(testlib.RouterMixin, testlib.TestCase):
# Subsequent master allocation does not collide # Subsequent master allocation does not collide
c2 = self.router.local() c2 = self.router.local()
self.assertEquals(1002, c2.context_id) self.assertEquals(1002, c2.context_id)
if __name__ == '__main__':
unittest2.main()

@ -5,7 +5,6 @@ import types
import zlib import zlib
import mock import mock
import unittest2
import mitogen.core import mitogen.core
import mitogen.utils import mitogen.utils
@ -221,7 +220,3 @@ class SelfReplacingModuleTest(testlib.RouterMixin, testlib.TestCase):
c = self.router.local() c = self.router.local()
self.assertEquals(0, self.assertEquals(0,
c.call(simple_pkg.imports_replaces_self.subtract_one, 1)) c.call(simple_pkg.imports_replaces_self.subtract_one, 1))
if __name__ == '__main__':
unittest2.main()

@ -3,7 +3,6 @@ import errno
import select import select
import mock import mock
import unittest2
import testlib import testlib
import mitogen.core import mitogen.core
@ -122,7 +121,3 @@ class SelectExceptionTest(ExceptionTest, testlib.TestCase):
class OsErrorExceptionTest(ExceptionTest, testlib.TestCase): class OsErrorExceptionTest(ExceptionTest, testlib.TestCase):
errno = errno.EBADF errno = errno.EBADF
exception_class = OSError exception_class = OSError
if __name__ == '__main__':
unittest2.main()

@ -1,6 +1,7 @@
import unittest
import mock import mock
import unittest2
import mitogen.core import mitogen.core
@ -13,7 +14,7 @@ except NameError:
return it.next() return it.next()
class IterSplitTest(unittest2.TestCase): class IterSplitTest(unittest.TestCase):
func = staticmethod(mitogen.core.iter_split) func = staticmethod(mitogen.core.iter_split)
def test_empty_buffer(self): def test_empty_buffer(self):
@ -60,7 +61,3 @@ class IterSplitTest(unittest2.TestCase):
trailer, cont = self.func(buf=buf, delim='\n', func=func) trailer, cont = self.func(buf=buf, delim='\n', func=func)
self.assertFalse(cont) self.assertFalse(cont)
self.assertEquals('zz', trailer) self.assertEquals('zz', trailer)
if __name__ == '__main__':
unittest2.main()

@ -4,8 +4,6 @@ import os
import mitogen import mitogen
import mitogen.parent import mitogen.parent
import unittest2
import testlib import testlib
@ -27,7 +25,3 @@ class ConstructorTest(testlib.RouterMixin, testlib.TestCase):
'-c', '-c',
]) ])
self.assertEquals('1', context.call(os.getenv, 'THIS_IS_STUB_JEXEC')) self.assertEquals('1', context.call(os.getenv, 'THIS_IS_STUB_JEXEC'))
if __name__ == '__main__':
unittest2.main()

@ -4,8 +4,6 @@ import os
import mitogen import mitogen
import mitogen.parent import mitogen.parent
import unittest2
import testlib import testlib
@ -23,7 +21,3 @@ class ConstructorTest(testlib.RouterMixin, testlib.TestCase):
self.assertEquals(argv[1], 'exec') self.assertEquals(argv[1], 'exec')
self.assertEquals(argv[2], '-it') self.assertEquals(argv[2], '-it')
self.assertEquals(argv[3], 'pod_name') self.assertEquals(argv[3], 'pod_name')
if __name__ == '__main__':
unittest2.main()

@ -2,8 +2,6 @@
import sys import sys
import threading import threading
import unittest2
import mitogen.core import mitogen.core
import testlib import testlib
@ -212,8 +210,3 @@ class ThreadedCloseTest(testlib.TestCase):
self.assertEquals(self.results, [None]*5) self.assertEquals(self.results, [None]*5)
for exc in self.excs: for exc in self.excs:
self.assertTrue(isinstance(exc, mitogen.core.LatchError)) self.assertTrue(isinstance(exc, mitogen.core.LatchError))
if __name__ == '__main__':
unittest2.main()

@ -2,8 +2,6 @@
import os import os
import sys import sys
import unittest2
import mitogen import mitogen
import testlib import testlib
@ -48,7 +46,3 @@ class ConstructionTest(testlib.RouterMixin, testlib.TestCase):
env = context.call(get_os_environ) env = context.call(get_os_environ)
self.assertEquals('magic_first_arg', env['STUB_PYTHON_FIRST_ARG']) self.assertEquals('magic_first_arg', env['STUB_PYTHON_FIRST_ARG'])
self.assertEquals('1', env['THIS_IS_STUB_PYTHON']) self.assertEquals('1', env['THIS_IS_STUB_PYTHON'])
if __name__ == '__main__':
unittest2.main()

@ -2,8 +2,8 @@
import logging import logging
import mock import mock
import sys import sys
import unittest
import unittest2
import testlib import testlib
import mitogen.core import mitogen.core
import mitogen.master import mitogen.master
@ -86,11 +86,7 @@ class StartupTest(testlib.RouterMixin, testlib.TestCase):
expect = 'Parent is context %s (%s)' % (c1.context_id, 'parent') expect = 'Parent is context %s (%s)' % (c1.context_id, 'parent')
self.assertTrue(expect in logs) self.assertTrue(expect in logs)
StartupTest = unittest2.skipIf( StartupTest = unittest.skipIf(
condition=sys.version_info < (2, 7) or sys.version_info >= (3, 6), condition=sys.version_info < (2, 7) or sys.version_info >= (3, 6),
reason="Message log flaky on Python < 2.7 or >= 3.6" reason="Message log flaky on Python < 2.7 or >= 3.6"
)(StartupTest) )(StartupTest)
if __name__ == '__main__':
unittest2.main()

@ -8,8 +8,6 @@ try:
except NameError: except NameError:
from mitogen.core import any from mitogen.core import any
import unittest2
import testlib import testlib
@ -39,7 +37,3 @@ class ConstructorTest(testlib.RouterMixin, testlib.TestCase):
) )
) )
self.assertTrue(str(e).endswith(mitogen.lxc.Connection.eof_error_hint)) self.assertTrue(str(e).endswith(mitogen.lxc.Connection.eof_error_hint))
if __name__ == '__main__':
unittest2.main()

@ -4,8 +4,6 @@ import mitogen
import mitogen.lxd import mitogen.lxd
import mitogen.parent import mitogen.parent
import unittest2
import testlib import testlib
@ -31,7 +29,3 @@ class ConstructorTest(testlib.RouterMixin, testlib.TestCase):
) )
) )
self.assertTrue(str(e).endswith(mitogen.lxd.Connection.eof_error_hint)) self.assertTrue(str(e).endswith(mitogen.lxd.Connection.eof_error_hint))
if __name__ == '__main__':
unittest2.main()

@ -1,6 +1,5 @@
import inspect import inspect
import unittest
import unittest2
import testlib import testlib
import mitogen.master import mitogen.master
@ -16,7 +15,7 @@ class ScanCodeImportsTest(testlib.TestCase):
SIMPLE_EXPECT = [ SIMPLE_EXPECT = [
(level, 'inspect', ()), (level, 'inspect', ()),
(level, 'unittest2', ()), (level, 'unittest', ()),
(level, 'testlib', ()), (level, 'testlib', ()),
(level, 'mitogen.master', ()), (level, 'mitogen.master', ()),
] ]
@ -25,7 +24,3 @@ class ScanCodeImportsTest(testlib.TestCase):
source_path = inspect.getsourcefile(ScanCodeImportsTest) source_path = inspect.getsourcefile(ScanCodeImportsTest)
co = compile(open(source_path).read(), source_path, 'exec') co = compile(open(source_path).read(), source_path, 'exec')
self.assertEquals(list(self.func(co)), self.SIMPLE_EXPECT) self.assertEquals(list(self.func(co)), self.SIMPLE_EXPECT)
if __name__ == '__main__':
unittest2.main()

@ -1,9 +1,9 @@
import sys import sys
import struct import struct
import unittest
import mock import mock
import unittest2
import mitogen.core import mitogen.core
import mitogen.master import mitogen.master
@ -170,7 +170,7 @@ class PickledTest(testlib.TestCase):
for b in True, False: for b in True, False:
self.assertEquals(b, self.roundtrip(b)) self.assertEquals(b, self.roundtrip(b))
@unittest2.skipIf(condition=sys.version_info < (2, 6), @unittest.skipIf(condition=sys.version_info < (2, 6),
reason='bytearray missing on <2.6') reason='bytearray missing on <2.6')
def test_bytearray(self): def test_bytearray(self):
ba = bytearray(b('123')) ba = bytearray(b('123'))
@ -201,7 +201,7 @@ class PickledTest(testlib.TestCase):
for k in range(len(l)): for k in range(len(l)):
self.assertTrue(isinstance(roundtrip[k], type(l[k]))) self.assertTrue(isinstance(roundtrip[k], type(l[k])))
@unittest2.skipIf(condition=sys.version_info > (3, 0), @unittest.skipIf(condition=sys.version_info > (3, 0),
reason='long missing in >3.x') reason='long missing in >3.x')
def test_long(self): def test_long(self):
l = long(0xffffffffffff) l = long(0xffffffffffff)
@ -539,7 +539,3 @@ class ReprTest(testlib.TestCase):
def test_repr(self): def test_repr(self):
# doesn't crash # doesn't crash
repr(self.klass.pickled('test')) repr(self.klass.pickled('test'))
if __name__ == '__main__':
unittest2.main()

@ -3,8 +3,6 @@ import glob
import pprint import pprint
import sys import sys
import unittest2
import mitogen.minify import mitogen.minify
import testlib import testlib
@ -112,7 +110,3 @@ class MitogenCoreTest(testlib.TestCase):
self._test_syntax_valid(minified, name) self._test_syntax_valid(minified, name)
self._test_line_counts_match(original, minified) self._test_line_counts_match(original, minified)
self._test_non_blank_lines_match(name, original, minified) self._test_non_blank_lines_match(name, original, minified)
if __name__ == '__main__':
unittest2.main()

@ -1,5 +1,4 @@
import unittest2
import mock import mock
import mitogen.core import mitogen.core
@ -28,7 +27,3 @@ class ReceiveOneTest(testlib.TestCase):
self.assertEquals(1, stream.on_disconnect.call_count) self.assertEquals(1, stream.on_disconnect.call_count)
expect = self.klass.corrupt_msg % (stream.name, junk) expect = self.klass.corrupt_msg % (stream.name, junk)
self.assertTrue(expect in capture.raw()) self.assertTrue(expect in capture.raw())
if __name__ == '__main__':
unittest2.main()

@ -1,8 +1,7 @@
import inspect import inspect
import os import os
import sys import sys
import unittest
import unittest2
import mitogen.master import mitogen.master
from mitogen.core import b from mitogen.core import b
@ -395,7 +394,7 @@ if sys.version_info > (2, 6):
u'django.utils.six', u'django.utils.six',
]) ])
@unittest2.skipIf( @unittest.skipIf(
condition=(sys.version_info >= (3, 0)), condition=(sys.version_info >= (3, 0)),
reason='broken due to ancient vendored six.py' reason='broken due to ancient vendored six.py'
) )
@ -491,6 +490,3 @@ if sys.version_info > (2, 6):
u'pytz.tzfile', u'pytz.tzfile',
u'pytz.tzinfo', u'pytz.tzinfo',
]) ])
if __name__ == '__main__':
unittest2.main()

@ -1,7 +1,5 @@
import os import os
import unittest2
import testlib import testlib
@ -13,7 +11,3 @@ class NestedTest(testlib.RouterMixin, testlib.TestCase):
pid = context.call(os.getpid) pid = context.call(os.getpid)
self.assertIsInstance(pid, int) self.assertIsInstance(pid, int)
if __name__ == '__main__':
unittest2.main()

@ -1,6 +1,4 @@
import testlib import testlib
import unittest2
import mitogen.os_fork import mitogen.os_fork
import mitogen.service import mitogen.service
@ -45,8 +43,3 @@ class CorkTest(testlib.RouterMixin, testlib.TestCase):
self.assertEquals('pong', latch.get()) self.assertEquals('pong', latch.get())
finally: finally:
pool.stop(join=True) pool.stop(join=True)
if __name__ == '__main__':
unittest2.main()

@ -4,9 +4,9 @@ import os
import signal import signal
import sys import sys
import time import time
import unittest
import mock import mock
import unittest2
import testlib import testlib
import mitogen.core import mitogen.core
@ -188,7 +188,7 @@ class OpenPtyTest(testlib.TestCase):
msg = mitogen.parent.OPENPTY_MSG % (openpty.side_effect,) msg = mitogen.parent.OPENPTY_MSG % (openpty.side_effect,)
self.assertEquals(e.args[0], msg) self.assertEquals(e.args[0], msg)
@unittest2.skipIf(condition=(os.uname()[0] != 'Linux'), @unittest.skipIf(condition=(os.uname()[0] != 'Linux'),
reason='Fallback only supported on Linux') reason='Fallback only supported on Linux')
@mock.patch('os.openpty') @mock.patch('os.openpty')
def test_broken_linux_fallback(self, openpty): def test_broken_linux_fallback(self, openpty):
@ -288,7 +288,3 @@ class DisconnectTest(testlib.RouterMixin, testlib.TestCase):
lambda: recv.get().unpickle()) lambda: recv.get().unpickle())
s = 'mitogen.core.ChannelError: ' + self.router.respondent_disconnect_msg s = 'mitogen.core.ChannelError: ' + self.router.respondent_disconnect_msg
self.assertTrue(e.args[0].startswith(s)) self.assertTrue(e.args[0].startswith(s))
if __name__ == '__main__':
unittest2.main()

@ -1,5 +1,4 @@
import os import os
import unittest2
import mitogen import mitogen
@ -45,8 +44,3 @@ class ConstructorTest(testlib.RouterMixin, testlib.TestCase):
stream.conn.options.python_path stream.conn.options.python_path
] ]
self.assertEquals(argv[:len(expected_call)], expected_call) self.assertEquals(argv[:len(expected_call)], expected_call)
if __name__ == '__main__':
unittest2.main()

@ -1,6 +1,4 @@
import mock import mock
import unittest2
import mitogen.core import mitogen.core
import mitogen.parent import mitogen.parent
@ -34,7 +32,3 @@ class IsImmediateChildTest(testlib.TestCase):
def test_okay(self): def test_okay(self):
self.assertFalse(0, 1) self.assertFalse(0, 1)
self.assertTrue(1, 1) self.assertTrue(1, 1)
if __name__ == '__main__':
unittest2.main()

@ -4,9 +4,7 @@ import os
import select import select
import socket import socket
import sys import sys
import time import unittest
import unittest2
import mitogen.core import mitogen.core
import mitogen.parent import mitogen.parent
@ -400,7 +398,7 @@ class AllMixin(ReceiveStateMixin,
class SelectTest(AllMixin, testlib.TestCase): class SelectTest(AllMixin, testlib.TestCase):
klass = mitogen.core.Poller klass = mitogen.core.Poller
SelectTest = unittest2.skipIf( SelectTest = unittest.skipIf(
condition=(not SelectTest.klass.SUPPORTED), condition=(not SelectTest.klass.SUPPORTED),
reason='select.select() not supported' reason='select.select() not supported'
)(SelectTest) )(SelectTest)
@ -409,7 +407,7 @@ SelectTest = unittest2.skipIf(
class PollTest(AllMixin, testlib.TestCase): class PollTest(AllMixin, testlib.TestCase):
klass = mitogen.parent.PollPoller klass = mitogen.parent.PollPoller
PollTest = unittest2.skipIf( PollTest = unittest.skipIf(
condition=(not PollTest.klass.SUPPORTED), condition=(not PollTest.klass.SUPPORTED),
reason='select.poll() not supported' reason='select.poll() not supported'
)(PollTest) )(PollTest)
@ -418,7 +416,7 @@ PollTest = unittest2.skipIf(
class KqueueTest(AllMixin, testlib.TestCase): class KqueueTest(AllMixin, testlib.TestCase):
klass = mitogen.parent.KqueuePoller klass = mitogen.parent.KqueuePoller
KqueueTest = unittest2.skipIf( KqueueTest = unittest.skipIf(
condition=(not KqueueTest.klass.SUPPORTED), condition=(not KqueueTest.klass.SUPPORTED),
reason='select.kqueue() not supported' reason='select.kqueue() not supported'
)(KqueueTest) )(KqueueTest)
@ -427,11 +425,7 @@ KqueueTest = unittest2.skipIf(
class EpollTest(AllMixin, testlib.TestCase): class EpollTest(AllMixin, testlib.TestCase):
klass = mitogen.parent.EpollPoller klass = mitogen.parent.EpollPoller
EpollTest = unittest2.skipIf( EpollTest = unittest.skipIf(
condition=(not EpollTest.klass.SUPPORTED), condition=(not EpollTest.klass.SUPPORTED),
reason='select.epoll() not supported' reason='select.epoll() not supported'
)(EpollTest) )(EpollTest)
if __name__ == '__main__':
unittest2.main()

@ -1,6 +1,5 @@
import testlib import testlib
import unittest2
import mitogen.core import mitogen.core
from mitogen.core import b from mitogen.core import b
@ -97,7 +96,3 @@ class StrRpartitionTest(testlib.TestCase):
self.assertEquals(left, u'davexdave') self.assertEquals(left, u'davexdave')
self.assertEquals(sep, u'x') self.assertEquals(sep, u'x')
self.assertEquals(right, u'dave') self.assertEquals(right, u'dave')
if __name__ == '__main__':
unittest2.main()

@ -1,7 +1,6 @@
import os import os
import tempfile import tempfile
import unittest2
import mitogen.core import mitogen.core
import mitogen.service import mitogen.service
@ -50,7 +49,3 @@ class PropagateToTest(testlib.RouterMixin, testlib.TestCase):
self.assertEquals(b('test'), s) self.assertEquals(b('test'), s)
finally: finally:
tf.close() tf.close()
if __name__ == '__main__':
unittest2.main()

@ -1,6 +1,6 @@
import signal import signal
import unittest2
import testlib import testlib
import mock import mock
@ -48,7 +48,3 @@ class ReaperTest(testlib.TestCase):
mock.call(proc.pid, signal.SIGTERM), mock.call(proc.pid, signal.SIGTERM),
mock.call(proc.pid, signal.SIGKILL), mock.call(proc.pid, signal.SIGKILL),
]) ])
if __name__ == '__main__':
unittest2.main()

@ -1,7 +1,7 @@
import sys import sys
import threading import threading
import unittest2 import unittest
import mitogen.core import mitogen.core
import testlib import testlib
@ -120,7 +120,7 @@ class OnReceiveTest(testlib.RouterMixin, testlib.TestCase):
e = self.assertRaises(mitogen.core.ChannelError, throw) e = self.assertRaises(mitogen.core.ChannelError, throw)
self.assertEquals(e.args[0], sender.explicit_close_msg) self.assertEquals(e.args[0], sender.explicit_close_msg)
@unittest2.skip(reason=( @unittest.skip(reason=(
'Unclear if a asingle dead message received from remote should ' 'Unclear if a asingle dead message received from remote should '
'cause all threads to wake up.' 'cause all threads to wake up.'
)) ))
@ -153,7 +153,3 @@ class ToSenderTest(testlib.RouterMixin, testlib.TestCase):
myself = self.router.myself() myself = self.router.myself()
recv = self.klass(self.router) recv = self.klass(self.router)
self.assertEquals(myself, recv.to_sender().context) self.assertEquals(myself, recv.to_sender().context)
if __name__ == '__main__':
unittest2.main()

@ -9,7 +9,6 @@ pycparser==2.18 # Last version supporting 2.6.
pytest-catchlog==1.2.2 pytest-catchlog==1.2.2
pytest==3.1.2 pytest==3.1.2
timeoutcontext==1.2.0 timeoutcontext==1.2.0
unittest2==1.1.0
# Fix InsecurePlatformWarning while creating py26 tox environment # Fix InsecurePlatformWarning while creating py26 tox environment
# https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings # https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
urllib3[secure]==1.23; python_version < '2.7' urllib3[secure]==1.23; python_version < '2.7'

@ -3,8 +3,7 @@ import mock
import textwrap import textwrap
import subprocess import subprocess
import sys import sys
import unittest
import unittest2
import mitogen.master import mitogen.master
import testlib import testlib
@ -130,7 +129,7 @@ class BrokenModulesTest(testlib.TestCase):
self.assertEquals(('non_existent_module', None, None, None, ()), self.assertEquals(('non_existent_module', None, None, None, ()),
msg.unpickle()) msg.unpickle())
@unittest2.skipIf( @unittest.skipIf(
condition=sys.version_info < (2, 6), condition=sys.version_info < (2, 6),
reason='Ancient Python lacked "from . import foo"', reason='Ancient Python lacked "from . import foo"',
) )
@ -197,22 +196,18 @@ class ForwardTest(testlib.RouterMixin, testlib.TestCase):
class BlacklistTest(testlib.TestCase): class BlacklistTest(testlib.TestCase):
@unittest2.skip('implement me') @unittest.skip('implement me')
def test_whitelist_no_blacklist(self): def test_whitelist_no_blacklist(self):
assert 0 assert 0
@unittest2.skip('implement me') @unittest.skip('implement me')
def test_whitelist_has_blacklist(self): def test_whitelist_has_blacklist(self):
assert 0 assert 0
@unittest2.skip('implement me') @unittest.skip('implement me')
def test_blacklist_no_whitelist(self): def test_blacklist_no_whitelist(self):
assert 0 assert 0
@unittest2.skip('implement me') @unittest.skip('implement me')
def test_blacklist_has_whitelist(self): def test_blacklist_has_whitelist(self):
assert 0 assert 0
if __name__ == '__main__':
unittest2.main()

@ -4,8 +4,6 @@ import sys
import time import time
import zlib import zlib
import unittest2
import testlib import testlib
import mitogen.core import mitogen.core
import mitogen.master import mitogen.master
@ -583,7 +581,3 @@ class ShutdownTest(testlib.RouterMixin, testlib.TestCase):
ctx.context_id, ctx.context_id,
mitogen.context_id, mitogen.context_id,
)) ))
if __name__ == '__main__':
unittest2.main()

@ -1,6 +1,3 @@
import unittest2
import mitogen.select import mitogen.select
import testlib import testlib
@ -476,7 +473,3 @@ class GetEventTest(testlib.RouterMixin, testlib.TestCase):
event = select.get_event() event = select.get_event()
self.assertEquals(recv, event.source) self.assertEquals(recv, event.source)
self.assertEquals('123', event.data.unpickle()) self.assertEquals('123', event.data.unpickle())
if __name__ == '__main__':
unittest2.main()

@ -1,5 +1,3 @@
import unittest2
import mitogen.core import mitogen.core
import mitogen.service import mitogen.service
import testlib import testlib
@ -154,7 +152,3 @@ class CloseTest(testlib.RouterMixin, testlib.TestCase):
e = self.assertRaises(mitogen.core.ChannelError, e = self.assertRaises(mitogen.core.ChannelError,
lambda: self.router.myself().call_service(MyService, 'foobar')) lambda: self.router.myself().call_service(MyService, 'foobar'))
self.assertEquals(e.args[0], self.router.invalid_handle_msg) self.assertEquals(e.args[0], self.router.invalid_handle_msg)
if __name__ == '__main__':
unittest2.main()

@ -2,12 +2,11 @@
import os import os
import socket import socket
import sys import sys
import unittest
import mitogen import mitogen
import mitogen.parent import mitogen.parent
import unittest2
import testlib import testlib
@ -18,7 +17,7 @@ import testlib
# try: # try:
# root = self.router.sudo() # root = self.router.sudo()
# except mitogen.core.StreamError: # except mitogen.core.StreamError:
# raise unittest2.SkipTest("requires sudo to localhost root") # raise unittest.SkipTest("requires sudo to localhost root")
# via_ssh = self.docker_ssh( # via_ssh = self.docker_ssh(
# username='mitogen__has_sudo', # username='mitogen__has_sudo',
@ -37,11 +36,7 @@ import testlib
# ) # )
# DockerTest = unittest2.skipIf( # DockerTest = unittest.skipIf(
# condition=sys.version_info < (2, 5), # condition=sys.version_info < (2, 5),
# reason="mitogen.setns unsupported on Python <2.4" # reason="mitogen.setns unsupported on Python <2.4"
# )(DockerTest) # )(DockerTest)
# if __name__ == '__main__':
# unittest2.main()

@ -1,6 +1,4 @@
import unittest2
import testlib import testlib
import mitogen.core import mitogen.core
@ -39,7 +37,3 @@ class ListenFireTest(testlib.TestCase):
self.assertEquals('event fired', latch2.get()) self.assertEquals('event fired', latch2.get())
self.assertTrue(latch.empty()) self.assertTrue(latch.empty())
self.assertTrue(latch2.empty()) self.assertTrue(latch2.empty())
if __name__ == '__main__':
unittest2.main()

@ -6,8 +6,6 @@ import mitogen
import mitogen.ssh import mitogen.ssh
import mitogen.utils import mitogen.utils
import unittest2
import testlib import testlib
import plain_old_module import plain_old_module
@ -224,7 +222,3 @@ class StubCheckHostKeysTest(StubSshMixin, testlib.TestCase):
# required=true, password is not None # required=true, password is not None
context = self.stub_ssh(check_host_keys='ignore', password='willick') context = self.stub_ssh(check_host_keys='ignore', password='willick')
self.assertEquals('1', context.call(os.getenv, 'STDERR_WAS_TTY')) self.assertEquals('1', context.call(os.getenv, 'STDERR_WAS_TTY'))
if __name__ == '__main__':
unittest2.main()

@ -4,8 +4,6 @@ import os
import mitogen import mitogen
import mitogen.su import mitogen.su
import unittest2
import testlib import testlib
@ -67,7 +65,3 @@ class SuTest(testlib.DockerMixin, testlib.TestCase):
) )
context = self.router.su(via=ssh, password='rootpassword') context = self.router.su(via=ssh, password='rootpassword')
self.assertEquals(0, context.call(os.getuid)) self.assertEquals(0, context.call(os.getuid))
if __name__ == '__main__':
unittest2.main()

@ -4,8 +4,6 @@ import os
import mitogen import mitogen
import mitogen.sudo import mitogen.sudo
import unittest2
import testlib import testlib
@ -104,7 +102,3 @@ class ConstructorTest(testlib.RouterMixin, testlib.TestCase):
# lambda: self.router.sudo(via=ssh, password='rootpassword') # lambda: self.router.sudo(via=ssh, password='rootpassword')
# ) # )
# self.assertTrue(mitogen.sudo.password_incorrect_msg in str(e)) # self.assertTrue(mitogen.sudo.password_incorrect_msg in str(e))
if __name__ == '__main__':
unittest2.main()

@ -11,9 +11,9 @@ import sys
import threading import threading
import time import time
import traceback import traceback
import unittest
import psutil import psutil
import unittest2
import mitogen.core import mitogen.core
import mitogen.fork import mitogen.fork
@ -328,7 +328,7 @@ class LogCapturer(object):
return self.raw() return self.raw()
class TestCase(unittest2.TestCase): class TestCase(unittest.TestCase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
# This is done in setUpClass() so we have a chance to run before any # This is done in setUpClass() so we have a chance to run before any
@ -460,7 +460,7 @@ class DockerizedSshDaemon(object):
try: try:
subprocess__check_output(['docker', '--version']) subprocess__check_output(['docker', '--version'])
except Exception: except Exception:
raise unittest2.SkipTest('Docker binary is unavailable') raise unittest.SkipTest('Docker binary is unavailable')
self.container_name = 'mitogen-test-%08x' % (random.getrandbits(64),) self.container_name = 'mitogen-test-%08x' % (random.getrandbits(64),)
args = [ args = [
@ -558,7 +558,7 @@ class DockerMixin(RouterMixin):
def setUpClass(cls): def setUpClass(cls):
super(DockerMixin, cls).setUpClass() super(DockerMixin, cls).setUpClass()
if os.environ.get('SKIP_DOCKER_TESTS'): if os.environ.get('SKIP_DOCKER_TESTS'):
raise unittest2.SkipTest('SKIP_DOCKER_TESTS is set') raise unittest.SkipTest('SKIP_DOCKER_TESTS is set')
# we want to be able to override test distro for some tests that need a different container spun up # we want to be able to override test distro for some tests that need a different container spun up
daemon_args = {} daemon_args = {}

@ -2,7 +2,6 @@
import time import time
import mock import mock
import unittest2
import mitogen.core import mitogen.core
import mitogen.parent import mitogen.parent
@ -195,7 +194,3 @@ class BrokerTimerTest(testlib.TestCase):
finally: finally:
router.broker.shutdown() router.broker.shutdown()
router.broker.join() router.broker.join()
if __name__ == '__main__':
unittest2.main()

@ -1,5 +1,3 @@
import unittest2
import mitogen.core import mitogen.core
import mitogen.master import mitogen.master
@ -23,7 +21,3 @@ class TwoThreeCompatTest(testlib.RouterMixin, testlib.TestCase):
spare2, = target.call(simple_pkg.ping.ping, spare) spare2, = target.call(simple_pkg.ping.ping, spare)
self.assertEquals(spare.context_id, spare2.context_id) self.assertEquals(spare.context_id, spare2.context_id)
self.assertEquals(spare.name, spare2.name) self.assertEquals(spare.name, spare2.name)
if __name__ == '__main__':
unittest2.main()

@ -8,7 +8,7 @@ except ImportError:
from StringIO import StringIO as StringIO from StringIO import StringIO as StringIO
from StringIO import StringIO as BytesIO from StringIO import StringIO as BytesIO
import unittest2 import unittest
import mitogen.core import mitogen.core
from mitogen.core import b from mitogen.core import b
@ -95,14 +95,14 @@ class KwargsTest(testlib.TestCase):
self.assertTrue(type(dct) is dict) self.assertTrue(type(dct) is dict)
self.assertEquals({}, dct) self.assertEquals({}, dct)
@unittest2.skipIf(condition=(sys.version_info >= (2, 6)), @unittest.skipIf(condition=(sys.version_info >= (2, 6)),
reason='py<2.6 only') reason='py<2.6 only')
def test_bytes_conversion(self): def test_bytes_conversion(self):
kw = self.klass({u'key': 123}) kw = self.klass({u'key': 123})
self.assertEquals({'key': 123}, kw) self.assertEquals({'key': 123}, kw)
self.assertEquals("Kwargs({'key': 123})", repr(kw)) self.assertEquals("Kwargs({'key': 123})", repr(kw))
@unittest2.skipIf(condition=not mitogen.core.PY3, @unittest.skipIf(condition=not mitogen.core.PY3,
reason='py3 only') reason='py3 only')
def test_unicode_conversion(self): def test_unicode_conversion(self):
kw = self.klass({mitogen.core.b('key'): 123}) kw = self.klass({mitogen.core.b('key'): 123})
@ -142,7 +142,3 @@ class ToTextTest(testlib.TestCase):
s = self.func(123) s = self.func(123)
self.assertEquals(mitogen.core.UnicodeType, type(s)) self.assertEquals(mitogen.core.UnicodeType, type(s))
self.assertEquals(s, u'123') self.assertEquals(s, u'123')
if __name__ == '__main__':
unittest2.main()

@ -5,8 +5,6 @@ import subprocess
import sys import sys
import time import time
import unittest2
import mitogen import mitogen
import mitogen.master import mitogen.master
import mitogen.service import mitogen.service
@ -148,5 +146,3 @@ class ClientTest(testlib.TestCase):
if __name__ == '__main__': if __name__ == '__main__':
if len(sys.argv) == 3 and sys.argv[1] == 'ClientTest_server': if len(sys.argv) == 3 and sys.argv[1] == 'ClientTest_server':
ClientTest._test_simple_server(path=sys.argv[2]) ClientTest._test_simple_server(path=sys.argv[2])
else:
unittest2.main()

@ -3,7 +3,6 @@
import os import os
import tempfile import tempfile
import unittest2
import mock import mock
import mitogen.core import mitogen.core
@ -98,7 +97,3 @@ class CastTest(testlib.TestCase):
def test_unknown(self): def test_unknown(self):
self.assertRaises(TypeError, mitogen.utils.cast, set()) self.assertRaises(TypeError, mitogen.utils.cast, set())
self.assertRaises(TypeError, mitogen.utils.cast, 4j) self.assertRaises(TypeError, mitogen.utils.cast, 4j)
if __name__ == '__main__':
unittest2.main()

Loading…
Cancel
Save