File: setns_test.py

package info (click to toggle)
python-mitogen 0.3.0~rc1-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 3,240 kB
  • sloc: python: 19,899; sh: 91; perl: 19; ansic: 18; makefile: 13
file content (47 lines) | stat: -rw-r--r-- 1,215 bytes parent folder | download
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

import os
import socket
import sys

import mitogen
import mitogen.parent

import unittest2

import testlib


# TODO: https://github.com/dw/mitogen/issues/688 https://travis-ci.org/github/dw/mitogen/jobs/665088918?utm_medium=notification&utm_source=github_status
# class DockerTest(testlib.DockerMixin, testlib.TestCase):
#     def test_okay(self):
#         # Magic calls must happen as root.
#         try:
#             root = self.router.sudo()
#         except mitogen.core.StreamError:
#             raise unittest2.SkipTest("requires sudo to localhost root")

#         via_ssh = self.docker_ssh(
#             username='mitogen__has_sudo',
#             password='has_sudo_password',
#         )

#         via_setns = self.router.setns(
#             kind='docker',
#             container=self.dockerized_ssh.container_name,
#             via=root,
#         )

#         self.assertEquals(
#             via_ssh.call(socket.gethostname),
#             via_setns.call(socket.gethostname),
#         )


# DockerTest = unittest2.skipIf(
#     condition=sys.version_info < (2, 5),
#     reason="mitogen.setns unsupported on Python <2.4"
# )(DockerTest)


# if __name__ == '__main__':
#     unittest2.main()