Skip to content

Commit a50ea1b

Browse files
authored
Merge pull request #11152 from Zac-HD/drop-py37
2 parents 81cfb3f + 0353a94 commit a50ea1b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+164
-363
lines changed

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
- name: Set up Python
4646
uses: actions/setup-python@v4
4747
with:
48-
python-version: "3.7"
48+
python-version: "3.11"
4949

5050
- name: Install tox
5151
run: |

.github/workflows/test.yml

Lines changed: 22 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -37,25 +37,23 @@ jobs:
3737
fail-fast: false
3838
matrix:
3939
name: [
40-
"windows-py37",
41-
"windows-py37-pluggy",
4240
"windows-py38",
41+
"windows-py38-pluggy",
4342
"windows-py39",
4443
"windows-py310",
4544
"windows-py311",
4645
"windows-py312",
4746

48-
"ubuntu-py37",
49-
"ubuntu-py37-pluggy",
50-
"ubuntu-py37-freeze",
5147
"ubuntu-py38",
48+
"ubuntu-py38-pluggy",
49+
"ubuntu-py38-freeze",
5250
"ubuntu-py39",
5351
"ubuntu-py310",
5452
"ubuntu-py311",
5553
"ubuntu-py312",
5654
"ubuntu-pypy3",
5755

58-
"macos-py37",
56+
"macos-py38",
5957
"macos-py39",
6058
"macos-py310",
6159
"macos-py312",
@@ -66,19 +64,15 @@ jobs:
6664
]
6765

6866
include:
69-
- name: "windows-py37"
70-
python: "3.7"
71-
os: windows-latest
72-
tox_env: "py37-numpy"
73-
- name: "windows-py37-pluggy"
74-
python: "3.7"
75-
os: windows-latest
76-
tox_env: "py37-pluggymain-pylib-xdist"
7767
- name: "windows-py38"
7868
python: "3.8"
7969
os: windows-latest
8070
tox_env: "py38-unittestextras"
8171
use_coverage: true
72+
- name: "windows-py38-pluggy"
73+
python: "3.8"
74+
os: windows-latest
75+
tox_env: "py38-pluggymain-pylib-xdist"
8276
- name: "windows-py39"
8377
python: "3.9"
8478
os: windows-latest
@@ -96,23 +90,19 @@ jobs:
9690
os: windows-latest
9791
tox_env: "py312"
9892

99-
- name: "ubuntu-py37"
100-
python: "3.7"
93+
- name: "ubuntu-py38"
94+
python: "3.8"
10195
os: ubuntu-latest
102-
tox_env: "py37-lsof-numpy-pexpect"
96+
tox_env: "py38-lsof-numpy-pexpect"
10397
use_coverage: true
104-
- name: "ubuntu-py37-pluggy"
105-
python: "3.7"
106-
os: ubuntu-latest
107-
tox_env: "py37-pluggymain-pylib-xdist"
108-
- name: "ubuntu-py37-freeze"
109-
python: "3.7"
98+
- name: "ubuntu-py38-pluggy"
99+
python: "3.8"
110100
os: ubuntu-latest
111-
tox_env: "py37-freeze"
112-
- name: "ubuntu-py38"
101+
tox_env: "py38-pluggymain-pylib-xdist"
102+
- name: "ubuntu-py38-freeze"
113103
python: "3.8"
114104
os: ubuntu-latest
115-
tox_env: "py38-xdist"
105+
tox_env: "py38-freeze"
116106
- name: "ubuntu-py39"
117107
python: "3.9"
118108
os: ubuntu-latest
@@ -132,14 +122,14 @@ jobs:
132122
tox_env: "py312"
133123
use_coverage: true
134124
- name: "ubuntu-pypy3"
135-
python: "pypy-3.7"
125+
python: "pypy-3.8"
136126
os: ubuntu-latest
137127
tox_env: "pypy3-xdist"
138128

139-
- name: "macos-py37"
140-
python: "3.7"
129+
- name: "macos-py38"
130+
python: "3.8"
141131
os: macos-latest
142-
tox_env: "py37-xdist"
132+
tox_env: "py38-xdist"
143133
- name: "macos-py39"
144134
python: "3.9"
145135
os: macos-latest
@@ -160,11 +150,11 @@ jobs:
160150
tox_env: "plugins"
161151

162152
- name: "docs"
163-
python: "3.7"
153+
python: "3.8"
164154
os: ubuntu-latest
165155
tox_env: "docs"
166156
- name: "doctesting"
167-
python: "3.7"
157+
python: "3.8"
168158
os: ubuntu-latest
169159
tox_env: "doctesting"
170160
use_coverage: true

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ repos:
4040
rev: v3.10.0
4141
hooks:
4242
- id: reorder-python-imports
43-
args: ['--application-directories=.:src', --py37-plus]
43+
args: ['--application-directories=.:src', --py38-plus]
4444
- repo: https://github.com/asottile/pyupgrade
4545
rev: v3.7.0
4646
hooks:
4747
- id: pyupgrade
48-
args: [--py37-plus]
48+
args: [--py38-plus]
4949
- repo: https://github.com/asottile/setup-cfg-fmt
5050
rev: v2.3.0
5151
hooks:

CONTRIBUTING.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ Short version
201201
#. Follow **PEP-8** for naming and `black <https://github.com/psf/black>`_ for formatting.
202202
#. Tests are run using ``tox``::
203203

204-
tox -e linting,py37
204+
tox -e linting,py39
205205

206206
The test environments above are usually enough to cover most cases locally.
207207

@@ -272,24 +272,24 @@ Here is a simple overview, with pytest-specific bits:
272272

273273
#. Run all the tests
274274

275-
You need to have Python 3.7 available in your system. Now
275+
You need to have Python 3.8 or later available in your system. Now
276276
running tests is as simple as issuing this command::
277277

278-
$ tox -e linting,py37
278+
$ tox -e linting,py39
279279

280-
This command will run tests via the "tox" tool against Python 3.7
280+
This command will run tests via the "tox" tool against Python 3.9
281281
and also perform "lint" coding-style checks.
282282

283283
#. You can now edit your local working copy and run the tests again as necessary. Please follow PEP-8 for naming.
284284

285-
You can pass different options to ``tox``. For example, to run tests on Python 3.7 and pass options to pytest
285+
You can pass different options to ``tox``. For example, to run tests on Python 3.9 and pass options to pytest
286286
(e.g. enter pdb on failure) to pytest you can do::
287287

288-
$ tox -e py37 -- --pdb
288+
$ tox -e py39 -- --pdb
289289

290-
Or to only run tests in a particular test module on Python 3.7::
290+
Or to only run tests in a particular test module on Python 3.9::
291291

292-
$ tox -e py37 -- testing/test_config.py
292+
$ tox -e py39 -- testing/test_config.py
293293

294294

295295
When committing, ``pre-commit`` will re-format the files if necessary.

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ Features
100100
- Can run `unittest <https://docs.pytest.org/en/stable/how-to/unittest.html>`_ (or trial),
101101
`nose <https://docs.pytest.org/en/stable/how-to/nose.html>`_ test suites out of the box
102102

103-
- Python 3.7+ or PyPy3
103+
- Python 3.8+ or PyPy3
104104

105105
- Rich plugin architecture, with over 850+ `external plugins <https://docs.pytest.org/en/latest/reference/plugin_list.html>`_ and thriving community
106106

changelog/11151.breaking.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Dropped support for Python 3.7, which `reached end-of-life on 2023-06-27
2+
<https://devguide.python.org/versions/>`__.

doc/en/backwards-compatibility.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ Released pytest versions support all Python versions that are actively maintaine
8787
============== ===================
8888
pytest version min. Python version
8989
============== ===================
90+
8.0+ 3.8+
9091
7.1+ 3.7+
9192
6.2 - 7.0 3.6+
9293
5.0 - 6.1 3.5+

doc/en/conf.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,10 @@
1515
#
1616
# The full version, including alpha/beta/rc tags.
1717
# The short X.Y version.
18-
import ast
1918
import os
2019
import shutil
2120
import sys
2221
from textwrap import dedent
23-
from typing import List
2422
from typing import TYPE_CHECKING
2523

2624
from _pytest import __version__ as version
@@ -451,25 +449,6 @@ def setup(app: "sphinx.application.Sphinx") -> None:
451449

452450
configure_logging(app)
453451

454-
# Make Sphinx mark classes with "final" when decorated with @final.
455-
# We need this because we import final from pytest._compat, not from
456-
# typing (for Python < 3.8 compat), so Sphinx doesn't detect it.
457-
# To keep things simple we accept any `@final` decorator.
458-
# Ref: https://github.com/pytest-dev/pytest/pull/7780
459-
import sphinx.pycode.ast
460-
import sphinx.pycode.parser
461-
462-
original_is_final = sphinx.pycode.parser.VariableCommentPicker.is_final
463-
464-
def patched_is_final(self, decorators: List[ast.expr]) -> bool:
465-
if original_is_final(self, decorators):
466-
return True
467-
return any(
468-
sphinx.pycode.ast.unparse(decorator) == "final" for decorator in decorators
469-
)
470-
471-
sphinx.pycode.parser.VariableCommentPicker.is_final = patched_is_final
472-
473452
# legacypath.py monkey-patches pytest.Testdir in. Import the file so
474453
# that autodoc can discover references to it.
475454
import _pytest.legacypath # noqa: F401

doc/en/getting-started.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Get Started
99
Install ``pytest``
1010
----------------------------------------
1111

12-
``pytest`` requires: Python 3.7+ or PyPy3.
12+
``pytest`` requires: Python 3.8+ or PyPy3.
1313

1414
1. Run the following command in your command line:
1515

doc/en/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ Features
7777

7878
- Can run :ref:`unittest <unittest>` (including trial) and :ref:`nose <noseintegration>` test suites out of the box
7979

80-
- Python 3.7+ or PyPy 3
80+
- Python 3.8+ or PyPy 3
8181

8282
- Rich plugin architecture, with over 800+ :ref:`external plugins <plugin-list>` and thriving community
8383

setup.cfg

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ classifiers =
1717
Operating System :: POSIX
1818
Programming Language :: Python :: 3
1919
Programming Language :: Python :: 3 :: Only
20-
Programming Language :: Python :: 3.7
2120
Programming Language :: Python :: 3.8
2221
Programming Language :: Python :: 3.9
2322
Programming Language :: Python :: 3.10
@@ -50,9 +49,8 @@ install_requires =
5049
pluggy>=0.12,<2.0
5150
colorama;sys_platform=="win32"
5251
exceptiongroup>=1.0.0rc8;python_version<"3.11"
53-
importlib-metadata>=0.12;python_version<"3.8"
5452
tomli>=1.0.0;python_version<"3.11"
55-
python_requires = >=3.7
53+
python_requires = >=3.8
5654
package_dir =
5755
=src
5856
setup_requires =

src/_pytest/_code/code.py

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,21 @@
1717
from typing import Callable
1818
from typing import ClassVar
1919
from typing import Dict
20+
from typing import Final
21+
from typing import final
2022
from typing import Generic
2123
from typing import Iterable
2224
from typing import List
25+
from typing import Literal
2326
from typing import Mapping
2427
from typing import Optional
2528
from typing import overload
2629
from typing import Pattern
2730
from typing import Sequence
2831
from typing import Set
32+
from typing import SupportsIndex
2933
from typing import Tuple
3034
from typing import Type
31-
from typing import TYPE_CHECKING
3235
from typing import TypeVar
3336
from typing import Union
3437

@@ -42,22 +45,16 @@
4245
from _pytest._io import TerminalWriter
4346
from _pytest._io.saferepr import safeformat
4447
from _pytest._io.saferepr import saferepr
45-
from _pytest.compat import final
4648
from _pytest.compat import get_real_func
4749
from _pytest.deprecated import check_ispytest
4850
from _pytest.pathlib import absolutepath
4951
from _pytest.pathlib import bestrelpath
5052

51-
if TYPE_CHECKING:
52-
from typing_extensions import Final
53-
from typing_extensions import Literal
54-
from typing_extensions import SupportsIndex
55-
56-
_TracebackStyle = Literal["long", "short", "line", "no", "native", "value", "auto"]
57-
5853
if sys.version_info[:2] < (3, 11):
5954
from exceptiongroup import BaseExceptionGroup
6055

56+
_TracebackStyle = Literal["long", "short", "line", "no", "native", "value", "auto"]
57+
6158

6259
class Code:
6360
"""Wrapper around Python code objects."""
@@ -633,7 +630,7 @@ def _getreprcrash(self) -> Optional["ReprFileLocation"]:
633630
def getrepr(
634631
self,
635632
showlocals: bool = False,
636-
style: "_TracebackStyle" = "long",
633+
style: _TracebackStyle = "long",
637634
abspath: bool = False,
638635
tbfilter: Union[
639636
bool, Callable[["ExceptionInfo[BaseException]"], Traceback]
@@ -725,7 +722,7 @@ class FormattedExcinfo:
725722
fail_marker: ClassVar = "E"
726723

727724
showlocals: bool = False
728-
style: "_TracebackStyle" = "long"
725+
style: _TracebackStyle = "long"
729726
abspath: bool = True
730727
tbfilter: Union[bool, Callable[[ExceptionInfo[BaseException]], Traceback]] = True
731728
funcargs: bool = False
@@ -1090,7 +1087,7 @@ def toterminal(self, tw: TerminalWriter) -> None:
10901087
class ReprTraceback(TerminalRepr):
10911088
reprentries: Sequence[Union["ReprEntry", "ReprEntryNative"]]
10921089
extraline: Optional[str]
1093-
style: "_TracebackStyle"
1090+
style: _TracebackStyle
10941091

10951092
entrysep: ClassVar = "_ "
10961093

@@ -1124,7 +1121,7 @@ def __init__(self, tblines: Sequence[str]) -> None:
11241121
class ReprEntryNative(TerminalRepr):
11251122
lines: Sequence[str]
11261123

1127-
style: ClassVar["_TracebackStyle"] = "native"
1124+
style: ClassVar[_TracebackStyle] = "native"
11281125

11291126
def toterminal(self, tw: TerminalWriter) -> None:
11301127
tw.write("".join(self.lines))
@@ -1136,7 +1133,7 @@ class ReprEntry(TerminalRepr):
11361133
reprfuncargs: Optional["ReprFuncArgs"]
11371134
reprlocals: Optional["ReprLocals"]
11381135
reprfileloc: Optional["ReprFileLocation"]
1139-
style: "_TracebackStyle"
1136+
style: _TracebackStyle
11401137

11411138
def _write_entry_lines(self, tw: TerminalWriter) -> None:
11421139
"""Write the source code portions of a list of traceback entries with syntax highlighting.

src/_pytest/_code/source.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,7 @@ def get_statement_startend2(lineno: int, node: ast.AST) -> Tuple[int, Optional[i
149149
values: List[int] = []
150150
for x in ast.walk(node):
151151
if isinstance(x, (ast.stmt, ast.ExceptHandler)):
152-
# Before Python 3.8, the lineno of a decorated class or function pointed at the decorator.
153-
# Since Python 3.8, the lineno points to the class/def, so need to include the decorators.
152+
# The lineno points to the class/def, so need to include the decorators.
154153
if isinstance(x, (ast.ClassDef, ast.FunctionDef, ast.AsyncFunctionDef)):
155154
for d in x.decorator_list:
156155
values.append(d.lineno - 1)

src/_pytest/_io/terminalwriter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
import os
33
import shutil
44
import sys
5+
from typing import final
56
from typing import Optional
67
from typing import Sequence
78
from typing import TextIO
89

910
from .wcwidth import wcswidth
10-
from _pytest.compat import final
1111

1212

1313
# This code was initially copied from py 1.8.1, file _io/terminalwriter.py.

0 commit comments

Comments
 (0)