From 25bffc424d0d76b02e12ce835efedb03e95dfdc0 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Wed, 23 Jan 2019 12:44:08 +0000 Subject: [PATCH] issue #477: util/fakessh/two_three_compat fixes. --- tests/data/simple_pkg/ping.py | 6 ++++++ tests/fakessh_test.py | 3 --- tests/two_three_compat_test.py | 10 +++++----- tests/utils_test.py | 3 ++- 4 files changed, 13 insertions(+), 9 deletions(-) create mode 100644 tests/data/simple_pkg/ping.py diff --git a/tests/data/simple_pkg/ping.py b/tests/data/simple_pkg/ping.py new file mode 100644 index 00000000..722f7b87 --- /dev/null +++ b/tests/data/simple_pkg/ping.py @@ -0,0 +1,6 @@ + + +def ping(*args): + return args + + diff --git a/tests/fakessh_test.py b/tests/fakessh_test.py index 63c70058..e7dde711 100644 --- a/tests/fakessh_test.py +++ b/tests/fakessh_test.py @@ -2,7 +2,6 @@ import os import shutil -import timeoutcontext import unittest2 import mitogen.fakessh @@ -11,7 +10,6 @@ import testlib class RsyncTest(testlib.DockerMixin, testlib.TestCase): - @timeoutcontext.timeout(5) @unittest2.skip('broken') def test_rsync_from_master(self): context = self.docker_ssh_any() @@ -28,7 +26,6 @@ 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')) - @timeoutcontext.timeout(5) @unittest2.skip('broken') def test_rsync_between_direct_children(self): # master -> SSH -> mitogen__has_sudo_pubkey -> rsync(.ssh) -> master -> diff --git a/tests/two_three_compat_test.py b/tests/two_three_compat_test.py index f6f092d0..f30a233e 100644 --- a/tests/two_three_compat_test.py +++ b/tests/two_three_compat_test.py @@ -8,11 +8,11 @@ import mitogen.core import mitogen.master import testlib +import simple_pkg.ping -def roundtrip(*args): - return args - +# TODO: this is a joke. 2/3 interop is one of the hardest bits to get right. +# There should be 100 tests in this file. class TwoThreeCompatTest(testlib.RouterMixin, testlib.TestCase): if mitogen.core.PY3: @@ -21,10 +21,10 @@ class TwoThreeCompatTest(testlib.RouterMixin, testlib.TestCase): python_path = 'python3' def test_succeeds(self): - spare = self.router.fork() + spare = self.router.local() target = self.router.local(python_path=self.python_path) - spare2, = target.call(roundtrip, spare) + spare2, = target.call(simple_pkg.ping.ping, spare) self.assertEquals(spare.context_id, spare2.context_id) self.assertEquals(spare.name, spare2.name) diff --git a/tests/utils_test.py b/tests/utils_test.py index 5b81289e..17b260db 100644 --- a/tests/utils_test.py +++ b/tests/utils_test.py @@ -5,6 +5,7 @@ import unittest2 import mitogen.core import mitogen.master import mitogen.utils +from mitogen.core import b import testlib @@ -86,7 +87,7 @@ class CastTest(testlib.TestCase): self.assertEqual(type(mitogen.utils.cast(Unicode())), mitogen.core.UnicodeType) def test_bytes(self): - self.assertEqual(type(mitogen.utils.cast(b'')), mitogen.core.BytesType) + self.assertEqual(type(mitogen.utils.cast(b(''))), mitogen.core.BytesType) self.assertEqual(type(mitogen.utils.cast(Bytes())), mitogen.core.BytesType) def test_unknown(self):