Skip to content

Commit cb732f7

Browse files
authored
Merge branch 'main' into patch-1
2 parents 4719d99 + 6995257 commit cb732f7

Some content is hidden

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

65 files changed

+656
-567
lines changed

.github/workflows/deploy.yml

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,39 +13,53 @@ on:
1313
permissions: {}
1414

1515
jobs:
16-
17-
deploy:
18-
if: github.repository == 'pytest-dev/pytest'
19-
16+
build:
2017
runs-on: ubuntu-latest
21-
timeout-minutes: 30
22-
permissions:
23-
contents: write
24-
18+
timeout-minutes: 10
2519
steps:
2620
- uses: actions/checkout@v3
2721
with:
2822
fetch-depth: 0
2923
persist-credentials: false
30-
3124
- name: Build and Check Package
3225
uses: hynek/[email protected]
3326

27+
deploy:
28+
if: github.repository == 'pytest-dev/pytest'
29+
needs: [build]
30+
runs-on: ubuntu-latest
31+
timeout-minutes: 30
32+
permissions:
33+
id-token: write
34+
steps:
3435
- name: Download Package
3536
uses: actions/download-artifact@v3
3637
with:
3738
name: Packages
3839
path: dist
39-
4040
- name: Publish package to PyPI
41-
uses: pypa/gh-action-pypi-publish@release/v1
42-
with:
43-
password: ${{ secrets.pypi_token }}
41+
uses: pypa/gh-action-pypi-publish@v1.8.5
42+
43+
release-notes:
4444

45+
# todo: generate the content in the build job
46+
# the goal being of using a github action script to push the release data
47+
# after success instead of creating a complete python/tox env
48+
needs: [deploy]
49+
runs-on: ubuntu-latest
50+
timeout-minutes: 30
51+
permissions:
52+
contents: write
53+
steps:
54+
- uses: actions/checkout@v3
55+
with:
56+
fetch-depth: 0
57+
persist-credentials: false
4558
- name: Set up Python
4659
uses: actions/setup-python@v4
4760
with:
48-
python-version: "3.7"
61+
python-version: "3.11"
62+
4963

5064
- name: Install tox
5165
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: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ repos:
2121
exclude: _pytest/(debugging|hookspec).py
2222
language_version: python3
2323
- repo: https://github.com/PyCQA/autoflake
24-
rev: v2.1.1
24+
rev: v2.2.0
2525
hooks:
2626
- id: autoflake
2727
name: autoflake
@@ -40,14 +40,14 @@ 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
45-
rev: v3.7.0
45+
rev: v3.8.0
4646
hooks:
4747
- id: pyupgrade
48-
args: [--py37-plus]
48+
args: [--py38-plus]
4949
- repo: https://github.com/asottile/setup-cfg-fmt
50-
rev: v2.3.0
50+
rev: v2.4.0
5151
hooks:
5252
- id: setup-cfg-fmt
5353
args: ["--max-py-version=3.12", "--include-version-classifiers"]
@@ -56,7 +56,7 @@ repos:
5656
hooks:
5757
- id: python-use-type-annotations
5858
- repo: https://github.com/pre-commit/mirrors-mypy
59-
rev: v1.3.0
59+
rev: v1.4.1
6060
hooks:
6161
- id: mypy
6262
files: ^(src/|testing/)

AUTHORS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Adam Johnson
1111
Adam Stewart
1212
Adam Uhlir
1313
Ahn Ki-Wook
14+
Akhilesh Ramakrishnan
1415
Akiomi Kamakura
1516
Alan Velasco
1617
Alessio Izzo
@@ -129,6 +130,7 @@ Eric Hunsberger
129130
Eric Liu
130131
Eric Siegerman
131132
Erik Aronesty
133+
Erik Hasse
132134
Erik M. Bray
133135
Evan Kepner
134136
Evgeny Seliverstov
@@ -310,6 +312,7 @@ Raphael Pierzina
310312
Rafal Semik
311313
Raquel Alegre
312314
Ravi Chandra
315+
Reagan Lee
313316
Robert Holt
314317
Roberto Aldera
315318
Roberto Polli

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/10337.bugfix.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fixed that fake intermediate modules generated by ``--import-mode=importlib`` would not include the
2+
child modules as attributes of the parent modules.

changelog/10447.bugfix.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
markers are now considered in the reverse mro order to ensure base class markers are considered first
2+
this resolves a regression.

changelog/10811.bugfix.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fixed issue when using ``--import-mode=importlib`` together with ``--doctest-modules`` that caused modules
2+
to be imported more than once, causing problems with modules that have import side effects.

changelog/11011.doc.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Added a warning about modifying the root logger during tests when using ``caplog``.

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/>`__.

changelog/9036.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
``pytest.warns`` and similar functions now capture warnings when an exception is raised inside a ``with`` block.

changelog/9288.breaking.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
:func:`pytest.warns <warns>` now re-emits unmatched warnings when the context
2+
closes -- previously it would consume all warnings, hiding those that were not
3+
matched by the function.
4+
5+
While this is a new feature, we decided to announce this as a breaking change
6+
because many test suites are configured to error-out on warnings, and will
7+
therefore fail on the newly-re-emitted warnings.

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/how-to/logging.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,13 @@ the records for the ``setup`` and ``call`` stages during teardown like so:
172172
173173
The full API is available at :class:`pytest.LogCaptureFixture`.
174174

175+
.. warning::
176+
177+
The ``caplog`` fixture adds a handler to the root logger to capture logs. If the root logger is
178+
modified during a test, for example with ``logging.config.dictConfig``, this handler may be
179+
removed and cause no logs to be captured. To avoid this, ensure that any root logger configuration
180+
only adds to the existing handlers.
181+
175182

176183
.. _live_logs:
177184

0 commit comments

Comments
 (0)