File: two_three_compat_test.py

package info (click to toggle)
python-mitogen 0.3.26-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 6,456 kB
  • sloc: python: 22,134; sh: 183; makefile: 74; perl: 19; ansic: 18
file content (29 lines) | stat: -rw-r--r-- 896 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import unittest

import mitogen.core

import testlib
import simple_pkg.ping


# 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.

@unittest.skipIf(
    not testlib.have_python2() or not testlib.have_python3(),
    "Python 2/3 compatibility tests require both versions on the controller",
)
class TwoThreeCompatTest(testlib.RouterMixin, testlib.TestCase):
    if mitogen.core.PY3:
        python_path = 'python2'
    else:
        python_path = 'python3'

    @testlib.unittest.skip("Requires Python 2.7, no longer available")
    def test_succeeds(self):
        spare = self.router.local()
        target = self.router.local(python_path=self.python_path)

        spare2, = target.call(simple_pkg.ping.ping, spare)
        self.assertEqual(spare.context_id, spare2.context_id)
        self.assertEqual(spare.name, spare2.name)