Merge pull request #918 from moreati/python3.10

Python 3.10 support
pull/922/head
Alex Willmer 3 years ago committed by GitHub
commit c4f1cc150d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -25,9 +25,9 @@ jobs:
Mito_36:
python.version: '3.6'
tox.env: py36-mode_mitogen
Mito_39:
python.version: '3.9'
tox.env: py39-mode_mitogen
Mito_310:
python.version: '3.10'
tox.env: py310-mode_mitogen
# TODO: test python3, python3 tests are broken
Loc_27_210:
@ -72,9 +72,9 @@ jobs:
Mito_37:
python.version: '3.7'
tox.env: py37-mode_mitogen
Mito_39:
python.version: '3.9'
tox.env: py39-mode_mitogen
Mito_310:
python.version: '3.10'
tox.env: py310-mode_mitogen
# TODO: test python3, python3 tests are broken
Loc_27_210:
@ -162,33 +162,33 @@ jobs:
python.version: '3.6'
tox.env: py36-mode_mitogen-distro_ubuntu2004
Mito_39_centos6:
python.version: '3.9'
tox.env: py39-mode_mitogen-distro_centos6
Mito_39_centos7:
python.version: '3.9'
tox.env: py39-mode_mitogen-distro_centos7
Mito_39_centos8:
python.version: '3.9'
tox.env: py39-mode_mitogen-distro_centos8
Mito_39_debian9:
python.version: '3.9'
tox.env: py39-mode_mitogen-distro_debian9
Mito_39_debian10:
python.version: '3.9'
tox.env: py39-mode_mitogen-distro_debian10
Mito_39_debian11:
python.version: '3.9'
tox.env: py39-mode_mitogen-distro_debian11
Mito_39_ubuntu1604:
python.version: '3.9'
tox.env: py39-mode_mitogen-distro_ubuntu1604
Mito_39_ubuntu1804:
python.version: '3.9'
tox.env: py39-mode_mitogen-distro_ubuntu1804
Mito_39_ubuntu2004:
python.version: '3.9'
tox.env: py39-mode_mitogen-distro_ubuntu2004
Mito_310_centos6:
python.version: '3.10'
tox.env: py310-mode_mitogen-distro_centos6
Mito_310_centos7:
python.version: '3.10'
tox.env: py310-mode_mitogen-distro_centos7
Mito_310_centos8:
python.version: '3.10'
tox.env: py310-mode_mitogen-distro_centos8
Mito_310_debian9:
python.version: '3.10'
tox.env: py310-mode_mitogen-distro_debian9
Mito_310_debian10:
python.version: '3.10'
tox.env: py310-mode_mitogen-distro_debian10
Mito_310_debian11:
python.version: '3.10'
tox.env: py310-mode_mitogen-distro_debian11
Mito_310_ubuntu1604:
python.version: '3.10'
tox.env: py310-mode_mitogen-distro_ubuntu1604
Mito_310_ubuntu1804:
python.version: '3.10'
tox.env: py310-mode_mitogen-distro_ubuntu1804
Mito_310_ubuntu2004:
python.version: '3.10'
tox.env: py310-mode_mitogen-distro_ubuntu2004
#DebOps_2460_27_27:
#python.version: '2.7'
@ -247,15 +247,15 @@ jobs:
python.version: '3.6'
tox.env: py36-mode_ansible-ansible4
Ans_39_210:
python.version: '3.9'
tox.env: py39-mode_ansible-ansible2.10
Ans_39_3:
python.version: '3.9'
tox.env: py39-mode_ansible-ansible3
Ans_39_4:
python.version: '3.9'
tox.env: py39-mode_ansible-ansible4
Ans_39_5:
python.version: '3.9'
tox.env: py39-mode_ansible-ansible5
Ans_310_210:
python.version: '3.10'
tox.env: py310-mode_ansible-ansible2.10
Ans_310_3:
python.version: '3.10'
tox.env: py310-mode_ansible-ansible3
Ans_310_4:
python.version: '3.10'
tox.env: py310-mode_ansible-ansible4
Ans_310_5:
python.version: '3.10'
tox.env: py310-mode_ansible-ansible5

@ -147,8 +147,8 @@ Noteworthy Differences
* Mitogen 0.2.x supports Ansible 2.3-2.9; with Python 2.6, 2.7, or 3.6.
Mitogen 0.3.1+ supports
- Ansible 2.10, 3, and 4; with Python 2.7, or 3.6-3.9
- Ansible 5; with Python 3.8-3.9
- Ansible 2.10, 3, and 4; with Python 2.7, or 3.6-3.10
- Ansible 5; with Python 3.8-3.10
Verify your installation is running one of these versions by checking
``ansible --version`` output.

@ -22,6 +22,7 @@ v0.3.3.dev0
-------------------
* :gh:issue:`906` Support packages dynamically inserted into sys.modules, e.g. `distro` >= 1.7.0 as `ansible.module_utils.distro`.
* :gh:issue:`918` Support Python 3.10
v0.3.2 (2022-01-12)

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

@ -76,6 +76,7 @@ setup(
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: Implementation :: CPython',
'Topic :: System :: Distributed Computing',
'Topic :: System :: Systems Administration',

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

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

@ -6,8 +6,6 @@ import subprocess
import tempfile
import time
import unittest2
import mock
import ansible.errors
import ansible.playbook.play_context
@ -183,7 +181,3 @@ class PutFileTest(ConnectionMixin, testlib.TestCase):
path = tempfile.mktemp(prefix='mitotest')
self.assertRaises(ansible.errors.AnsibleFileNotFound,
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 tempfile
import mock
import unittest2
import testlib
from mitogen.core import b
@ -68,7 +66,3 @@ class WatcherTest(testlib.TestCase):
self.tf.flush()
watcher.check()
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 subprocess
import tempfile
import unittest2
import unittest
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)
def test_simple(self):
@ -67,7 +67,7 @@ class ApplyModeSpecTest(unittest2.TestCase):
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)
def test_creates(self):
@ -86,7 +86,7 @@ class IsGoodTempDirTest(unittest2.TestCase):
self.assertFalse(self.func(bleh))
self.assertEquals(open(bleh).read(), 'derp')
@unittest2.skipIf(
@unittest.skipIf(
os.geteuid() == 0, 'writes by root ignore directory permissions')
def test_unwriteable(self):
with NamedTemporaryDirectory() as temp_path:
@ -105,8 +105,3 @@ class IsGoodTempDirTest(unittest2.TestCase):
os_access.return_value = False
with NamedTemporaryDirectory() as temp_path:
self.assertFalse(self.func(temp_path))
if __name__ == '__main__':
unittest2.main()

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -8,8 +8,6 @@ try:
except NameError:
from mitogen.core import any
import unittest2
import testlib
@ -39,7 +37,3 @@ class ConstructorTest(testlib.RouterMixin, testlib.TestCase):
)
)
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.parent
import unittest2
import testlib
@ -31,7 +29,3 @@ class ConstructorTest(testlib.RouterMixin, testlib.TestCase):
)
)
self.assertTrue(str(e).endswith(mitogen.lxd.Connection.eof_error_hint))
if __name__ == '__main__':
unittest2.main()

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

@ -1,9 +1,9 @@
import sys
import struct
import unittest
import mock
import unittest2
import mitogen.core
import mitogen.master
@ -170,7 +170,7 @@ class PickledTest(testlib.TestCase):
for b in True, False:
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')
def test_bytearray(self):
ba = bytearray(b('123'))
@ -201,7 +201,7 @@ class PickledTest(testlib.TestCase):
for k in range(len(l)):
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')
def test_long(self):
l = long(0xffffffffffff)
@ -539,7 +539,3 @@ class ReprTest(testlib.TestCase):
def test_repr(self):
# doesn't crash
repr(self.klass.pickled('test'))
if __name__ == '__main__':
unittest2.main()

@ -3,8 +3,6 @@ import glob
import pprint
import sys
import unittest2
import mitogen.minify
import testlib
@ -112,7 +110,3 @@ class MitogenCoreTest(testlib.TestCase):
self._test_syntax_valid(minified, name)
self._test_line_counts_match(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 mitogen.core
@ -28,7 +27,3 @@ class ReceiveOneTest(testlib.TestCase):
self.assertEquals(1, stream.on_disconnect.call_count)
expect = self.klass.corrupt_msg % (stream.name, junk)
self.assertTrue(expect in capture.raw())
if __name__ == '__main__':
unittest2.main()

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

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

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

@ -4,9 +4,9 @@ import os
import signal
import sys
import time
import unittest
import mock
import unittest2
import testlib
import mitogen.core
@ -188,7 +188,7 @@ class OpenPtyTest(testlib.TestCase):
msg = mitogen.parent.OPENPTY_MSG % (openpty.side_effect,)
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')
@mock.patch('os.openpty')
def test_broken_linux_fallback(self, openpty):
@ -288,7 +288,3 @@ class DisconnectTest(testlib.RouterMixin, testlib.TestCase):
lambda: recv.get().unpickle())
s = 'mitogen.core.ChannelError: ' + self.router.respondent_disconnect_msg
self.assertTrue(e.args[0].startswith(s))
if __name__ == '__main__':
unittest2.main()

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

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

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

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

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

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

@ -1,7 +1,7 @@
import sys
import threading
import unittest2
import unittest
import mitogen.core
import testlib
@ -120,7 +120,7 @@ class OnReceiveTest(testlib.RouterMixin, testlib.TestCase):
e = self.assertRaises(mitogen.core.ChannelError, throw)
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 '
'cause all threads to wake up.'
))
@ -153,7 +153,3 @@ class ToSenderTest(testlib.RouterMixin, testlib.TestCase):
myself = self.router.myself()
recv = self.klass(self.router)
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==3.1.2
timeoutcontext==1.2.0
unittest2==1.1.0
# Fix InsecurePlatformWarning while creating py26 tox environment
# https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
urllib3[secure]==1.23; python_version < '2.7'

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

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

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

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

@ -2,12 +2,11 @@
import os
import socket
import sys
import unittest
import mitogen
import mitogen.parent
import unittest2
import testlib
@ -18,7 +17,7 @@ import testlib
# try:
# root = self.router.sudo()
# 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(
# username='mitogen__has_sudo',
@ -37,11 +36,7 @@ import testlib
# )
# DockerTest = unittest2.skipIf(
# DockerTest = unittest.skipIf(
# condition=sys.version_info < (2, 5),
# reason="mitogen.setns unsupported on Python <2.4"
# )(DockerTest)
# if __name__ == '__main__':
# unittest2.main()

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

@ -6,8 +6,6 @@ import mitogen
import mitogen.ssh
import mitogen.utils
import unittest2
import testlib
import plain_old_module
@ -224,7 +222,3 @@ class StubCheckHostKeysTest(StubSshMixin, testlib.TestCase):
# required=true, password is not None
context = self.stub_ssh(check_host_keys='ignore', password='willick')
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.su
import unittest2
import testlib
@ -67,7 +65,3 @@ class SuTest(testlib.DockerMixin, testlib.TestCase):
)
context = self.router.su(via=ssh, password='rootpassword')
self.assertEquals(0, context.call(os.getuid))
if __name__ == '__main__':
unittest2.main()

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

@ -11,9 +11,9 @@ import sys
import threading
import time
import traceback
import unittest
import psutil
import unittest2
import mitogen.core
import mitogen.fork
@ -328,7 +328,7 @@ class LogCapturer(object):
return self.raw()
class TestCase(unittest2.TestCase):
class TestCase(unittest.TestCase):
@classmethod
def setUpClass(cls):
# This is done in setUpClass() so we have a chance to run before any
@ -460,7 +460,7 @@ class DockerizedSshDaemon(object):
try:
subprocess__check_output(['docker', '--version'])
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),)
args = [
@ -558,7 +558,7 @@ class DockerMixin(RouterMixin):
def setUpClass(cls):
super(DockerMixin, cls).setUpClass()
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
daemon_args = {}

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

@ -1,5 +1,3 @@
import unittest2
import mitogen.core
import mitogen.master
@ -23,7 +21,3 @@ class TwoThreeCompatTest(testlib.RouterMixin, testlib.TestCase):
spare2, = target.call(simple_pkg.ping.ping, spare)
self.assertEquals(spare.context_id, spare2.context_id)
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 BytesIO
import unittest2
import unittest
import mitogen.core
from mitogen.core import b
@ -95,14 +95,14 @@ class KwargsTest(testlib.TestCase):
self.assertTrue(type(dct) is dict)
self.assertEquals({}, dct)
@unittest2.skipIf(condition=(sys.version_info >= (2, 6)),
@unittest.skipIf(condition=(sys.version_info >= (2, 6)),
reason='py<2.6 only')
def test_bytes_conversion(self):
kw = self.klass({u'key': 123})
self.assertEquals({'key': 123}, 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')
def test_unicode_conversion(self):
kw = self.klass({mitogen.core.b('key'): 123})
@ -142,7 +142,3 @@ class ToTextTest(testlib.TestCase):
s = self.func(123)
self.assertEquals(mitogen.core.UnicodeType, type(s))
self.assertEquals(s, u'123')
if __name__ == '__main__':
unittest2.main()

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

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

@ -36,10 +36,10 @@
envlist =
init,
py{27,36}-mode_ansible-ansible{2.10,3,4},
py{39}-mode_ansible-ansible{2.10,3,4,5},
py{27,36,39}-mode_mitogen-distro_centos{6,7,8},
py{27,36,39}-mode_mitogen-distro_debian{9,10,11},
py{27,36,39}-mode_mitogen-distro_ubuntu{1604,1804,2004},
py{310}-mode_ansible-ansible{2.10,3,4,5},
py{27,36,310}-mode_mitogen-distro_centos{6,7,8},
py{27,36,310}-mode_mitogen-distro_debian{9,10,11},
py{27,36,310}-mode_mitogen-distro_ubuntu{1604,1804,2004},
report,
requires =
tox-factor
@ -53,6 +53,7 @@ basepython =
py37: python3.7
py38: python3.8
py39: python3.9
py310: python3.10
deps =
-r{toxinidir}/tests/requirements.txt
mode_ansible: -r{toxinidir}/tests/ansible/requirements.txt

Loading…
Cancel
Save