tox tests on python 2.7 -> ImportError: cannot import name ThreadingTCPServer

tox tests on python 2.7 -> ImportError: cannot import name ThreadingTCPServer

运行 tox 我的 python 项目 我收到以下错误:

ERROR: invocation failed (exit code 1), logfile: /home/project/.tox/py27/log/py27-2.log
============================================================================================================= log start ==============================================================================================================
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Processing ./.tox/.tmp/package/1/hpecp-0.7.12.zip
  Installing build dependencies: started
  Installing build dependencies: finished with status 'error'
  ERROR: Command errored out with exit status 1:
   command: /home/project/.tox/py27/bin/python /home/project/.tox/py27/lib/python2.7/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-UBlzBQ/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.8.0' wheel
       cwd: None
  Complete output (22 lines):
  Traceback (most recent call last):
    File "/home/theia/.pyenv/versions/2.7.18/lib/python2.7/runpy.py", line 174, in _run_module_as_main
      "__main__", fname, loader, pkg_name)
    File "/home/theia/.pyenv/versions/2.7.18/lib/python2.7/runpy.py", line 72, in _run_code
      exec code in run_globals
    File "/home/project/.tox/py27/lib/python2.7/site-packages/pip/__main__.py", line 26, in <module>
      sys.exit(_main())
    File "/home/project/.tox/py27/lib/python2.7/site-packages/pip/_internal/cli/main.py", line 73, in main
      command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
    File "/home/project/.tox/py27/lib/python2.7/site-packages/pip/_internal/commands/__init__.py", line 104, in create_command
      module = importlib.import_module(module_path)
    File "/home/theia/.pyenv/versions/2.7.18/lib/python2.7/importlib/__init__.py", line 37, in import_module
      __import__(name)
    File "/home/project/.tox/py27/lib/python2.7/site-packages/pip/_internal/commands/install.py", line 17, in <module>
      from pip._internal.cli.req_command import RequirementCommand, with_cleanup
    File "/home/project/.tox/py27/lib/python2.7/site-packages/pip/_internal/cli/req_command.py", line 13, in <module>
      from pip._internal.cli.base_command import Command
    File "/home/project/.tox/py27/lib/python2.7/site-packages/pip/_internal/cli/base_command.py", line 6, in <module>
      import logging.config
    File "/home/theia/.pyenv/versions/2.7.18/lib/python2.7/logging/config.py", line 46, in <module>
      from SocketServer import ThreadingTCPServer, StreamRequestHandler
  ImportError: cannot import name ThreadingTCPServer
  ---------------------------------------
ERROR: Command errored out with exit status 1: /home/project/.tox/py27/bin/python /home/project/.tox/py27/lib/python2.7/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-UBlzBQ/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.8.0' wheel Check the logs for full command output.

我的tox.ini

[tox]
envlist = py27, py35, py36, py37, py38, py39
skip_missing_interpreters = True

[gh-actions]
python =
    2.7: py27
    3.5: py35
    3.6: py36
    3.7: py37
    3.8: py38

[testenv]
commands = nosetests {posargs}
deps =
    future
    jinja2
    mock
    nose
    requests
setenv = TOX_BUILD_DIR = {toxinidir}

[pytest]
addopts = -s

所有其他 python 版本工作正常。

我的问题是我在测试部门有前途:

[testenv]
commands = nosetests {posargs}
deps =
    future
    jinja2
    mock
    nose
    requests
setenv = TOX_BUILD_DIR = {toxinidir}

删除这个解决了我的问题。