From db9066fbfb00d03850c31aefefa273d7412ec68b Mon Sep 17 00:00:00 2001 From: David Wilson Date: Thu, 25 Jul 2019 12:03:17 +0100 Subject: [PATCH] [stream-refactor] mark setns module as requiring Python >2.4 --- docs/api.rst | 3 +++ tests/setns_test.py | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/docs/api.rst b/docs/api.rst index db39ad99..917fc627 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -383,6 +383,9 @@ Connection Methods the root PID of a running Docker, LXC, LXD, or systemd-nspawn container. + The setns method depends on the built-in :mod:`ctypes` module, and thus + does not support Python 2.4. + A program is required only to find the root PID, after which management of the child Python interpreter is handled directly. diff --git a/tests/setns_test.py b/tests/setns_test.py index b8a75788..d48179b1 100644 --- a/tests/setns_test.py +++ b/tests/setns_test.py @@ -1,6 +1,7 @@ import os import socket +import sys import mitogen import mitogen.parent @@ -34,5 +35,12 @@ class DockerTest(testlib.DockerMixin, testlib.TestCase): 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()