Skip to content

pytest 5.0 has dropped support for python2.7 / python3.4 #5519

@asottile

Description

@asottile

(to hopefully spearhead these issues from being created, I'm creating an intentionally invalid issue with the common failure modes)

please see Python 2.7 and 3.4 Support Plan

ways to avoid this

if pip is installing pytest>=5 on these versions, it likely means your pip is outdated. please upgrade to pip>=9 which understands the python_requires directive.

current stacktraces

These are the (current) stacktraces that'll be seen when running in the following versions:

python2.7

$ pytest --help
Traceback (most recent call last):
  File "/home/asottile/workspace/pytest/venv2/bin/pytest", line 11, in <module>
    load_entry_point('pytest==4.6.1.dev198+ge6ffa78e5', 'console_scripts', 'pytest')()
  File "/home/asottile/workspace/pytest/venv2/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 489, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/home/asottile/workspace/pytest/venv2/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2843, in load_entry_point
    return ep.load()
  File "/home/asottile/workspace/pytest/venv2/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2434, in load
    return self.resolve()
  File "/home/asottile/workspace/pytest/venv2/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2440, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/home/asottile/workspace/pytest/venv2/local/lib/python2.7/site-packages/pytest.py", line 6, in <module>
    from _pytest.assertion import register_assert_rewrite
  File "/home/asottile/workspace/pytest/venv2/local/lib/python2.7/site-packages/_pytest/assertion/__init__.py", line 6, in <module>
    from _pytest.assertion import rewrite
  File "/home/asottile/workspace/pytest/venv2/local/lib/python2.7/site-packages/_pytest/assertion/rewrite.py", line 462
    def _get_assertion_exprs(src: bytes):  # -> Dict[int, str]
                                ^
SyntaxError: invalid syntax

python3.4

$ pytest --help
Traceback (most recent call last):
  File "/home/asottile/workspace/pytest/venv34/bin/pytest", line 11, in <module>
    load_entry_point('pytest==4.6.1.dev198+ge6ffa78e5', 'console_scripts', 'pytest')()
  File "/home/asottile/workspace/pytest/venv34/lib/python3.4/site-packages/pkg_resources/__init__.py", line 489, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/home/asottile/workspace/pytest/venv34/lib/python3.4/site-packages/pkg_resources/__init__.py", line 2843, in load_entry_point
    return ep.load()
  File "/home/asottile/workspace/pytest/venv34/lib/python3.4/site-packages/pkg_resources/__init__.py", line 2434, in load
    return self.resolve()
  File "/home/asottile/workspace/pytest/venv34/lib/python3.4/site-packages/pkg_resources/__init__.py", line 2440, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/home/asottile/workspace/pytest/venv34/lib/python3.4/site-packages/pytest.py", line 6, in <module>
    from _pytest.assertion import register_assert_rewrite
  File "/home/asottile/workspace/pytest/venv34/lib/python3.4/site-packages/_pytest/assertion/__init__.py", line 6, in <module>
    from _pytest.assertion import rewrite
  File "/home/asottile/workspace/pytest/venv34/lib/python3.4/site-packages/_pytest/assertion/rewrite.py", line 443, in <module>
    ast.MatMult: "@",
AttributeError: 'module' object has no attribute 'MatMult'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions