From 49c54386b33458760c69a82fc85d3bec2eb034a2 Mon Sep 17 00:00:00 2001 From: Alex Willmer Date: Thu, 10 Aug 2023 09:31:32 +0100 Subject: [PATCH] tests: Only use subprocess32 package on Python 2.x This is how the package documentation recommends and it's less likely to interfere with new features in stdlib subprocess module. --- .ci/ci_lib.py | 5 ++++- tests/requirements.txt | 2 +- tests/testlib.py | 5 ++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.ci/ci_lib.py b/.ci/ci_lib.py index 47a8ddf3..3e716385 100644 --- a/.ci/ci_lib.py +++ b/.ci/ci_lib.py @@ -10,7 +10,10 @@ import shutil import sys import tempfile -import subprocess32 as subprocess +if sys.version_info < (3, 0): + import subprocess32 as subprocess +else: + import subprocess try: import urlparse diff --git a/tests/requirements.txt b/tests/requirements.txt index df755585..9e5e8c83 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -8,7 +8,7 @@ cffi==1.14.3 # Random pin to try and fix pyparser==2.18 not having effect pycparser==2.18 # Last version supporting 2.6. pytest-catchlog==1.2.2 pytest==3.1.2 -subprocess32==3.5.4 +subprocess32==3.5.4; python_version < '3.0' timeoutcontext==1.2.0 # Fix InsecurePlatformWarning while creating py26 tox environment # https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings diff --git a/tests/testlib.py b/tests/testlib.py index 242f211b..a8db4a2e 100644 --- a/tests/testlib.py +++ b/tests/testlib.py @@ -18,7 +18,10 @@ except ImportError: import ConfigParser as configparser import psutil -import subprocess32 as subprocess +if sys.version_info < (3, 0): + import subprocess32 as subprocess +else: + import subprocess import mitogen.core import mitogen.fork