Commit Graph

5173 Commits

Author SHA1 Message Date
Thomas Grainger 69e78b782b
Merge branch 'main' into bug-stopiteration-hook 2025-03-27 05:45:04 +00:00
pre-commit-ci[bot] e34fc6205a
[pre-commit.ci] pre-commit autoupdate (#13306)
updates:
  - [github.com/astral-sh/ruff-pre-commit: v0.9.10 → v0.11.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.9.10...v0.11.0)
  - [github.com/woodruffw/zizmor-pre-commit: v1.4.1 → v1.5.1](https://github.com/woodruffw/zizmor-pre-commit/compare/v1.4.1...v1.5.1)

* [lint] Put noqa in pyproject.toml or locally if possible

Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
2025-03-21 13:31:58 +01:00
dependabot[bot] 9666efad75
build(deps): Bump pytest-xvfb in /testing/plugins_integration (#13302)
Bumps [pytest-xvfb](https://github.com/The-Compiler/pytest-xvfb) from 3.0.0 to 3.1.1.
- [Changelog](https://github.com/The-Compiler/pytest-xvfb/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/The-Compiler/pytest-xvfb/compare/v3.0.0...v3.1.1)

---
updated-dependencies:
- dependency-name: pytest-xvfb
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-17 06:50:00 +01:00
dependabot[bot] 2125768966
build(deps): Bump anyio[trio] in /testing/plugins_integration (#13303)
Bumps [anyio[trio]](https://github.com/agronholm/anyio) from 4.8.0 to 4.9.0.
- [Release notes](https://github.com/agronholm/anyio/releases)
- [Changelog](https://github.com/agronholm/anyio/blob/master/docs/versionhistory.rst)
- [Commits](https://github.com/agronholm/anyio/compare/4.8.0...4.9.0)

---
updated-dependencies:
- dependency-name: anyio[trio]
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-17 06:49:22 +01:00
Ronny Pfannschmidt d149ab353a
assorted code updates and f string migrations (#12017)
* chore: setuponly - migrate to f string

* chore: MockTiming - move impl to _pytest.timing

* chore: fixture tests: migrate to f-strings

* chore: skipping tests: migrate to f-strings

* chore: junitxml tests: add more type annotations

* chore: junitxml tests: introduce more typesafe helpers

* add changelog

* test junitxml: split the DomNode type to express the Document/Element difference

* fixup: undo accidential name-mangling in the junitxml test helpers

* fixup: junitxml logging test - restore validation for expected output nodes

* fixup: have fake config .getini use correct types

* Update changelog/12017.improvement.rst

Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>

* use contrib category for changelog

* use datetime.fromisoformat instead of strptime

* post rebase ruff fixes

* add extra coverage for junit test helpers

---------

Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2025-03-11 09:14:36 +01:00
Anton Zhilin ada9977b2a
Prevent parametrize with scope from breaking fixture dependencies (#13249)
* Prevent parametrize with scope from breaking fixture dependencies

* Add myself to AUTHORS

* Fix the regression test

* Assert fixture value inside the test

---------

Co-authored-by: Bruno Oliveira <bruno@pytest.org>
2025-03-09 21:35:11 +01:00
John Litborn a98d093a71
improve raisesgroup code coverage (#13275)
* improve raisesgroup code coverage

* fix coverage of a weird branch in python_api, explicitify match in other test

* remove comment
2025-03-07 11:04:46 -08:00
dependabot[bot] 31d64fc53b
build(deps): Bump django in /testing/plugins_integration (#13276)
Bumps [django](https://github.com/django/django) from 5.1.6 to 5.1.7.
- [Commits](https://github.com/django/django/compare/5.1.6...5.1.7)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-07 06:23:52 +01:00
jakkdl 9163167507
Merge remote-tracking branch 'origin/main' into raisesgroup 2025-03-05 13:00:16 +01:00
Pierre Sassoulas a7479ced6c [pyupgrade] Apply pyupgrade on new code manually 2025-03-03 22:28:43 +01:00
jakkdl 5186f3677e
Merge remote-tracking branch 'origin/main' into raisesgroup 2025-03-03 12:28:16 +01:00
John Litborn 5bd393cf01
add --disable-plugin-autoload (#13253)
* add --disable-plugin-autoload

* update comments in test, don't check __spec__ on pypy (????), add changelog

* pemdas except not

* Apply suggestions from code review

Co-authored-by: Florian Bruhin <me@the-compiler.org>

* add parens

* Simplify plugin name in test_installed_plugin_rewrite

* Apply suggestions from code review

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Florian Bruhin <me@the-compiler.org>
Co-authored-by: Bruno Oliveira <bruno@pytest.org>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-03-01 14:27:25 -08:00
Andrew Pikul d3adf46ad7
Add capteesys capture fixture to bubble up output to `--capture` handler (#12854)
The config dict is passed alongside the class that the fixture will eventually initialize. It can use the config dict for optional arguments to the implementation's constructor.
2025-03-01 12:37:16 -03:00
Thomas Grainger 9af9742c04
Merge branch 'main' into bug-stopiteration-hook 2025-03-01 15:01:23 +00:00
Thomas Grainger cfb418d994
Update testing/example_scripts/hook_exceptions/test_stop_iteration.py 2025-03-01 15:01:13 +00:00
Adam Johnson 064638352d
Copy docstrings to wrapped pdb methods (#12947)
Co-authored-by: Bruno Oliveira <bruno@pytest.org>
Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
2025-03-01 12:00:17 -03:00
Anton Zhilin 611bb13108
Allow hiding a parameter set from test name (#13229)
Fixes #13228

---------

Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
2025-03-01 10:06:40 -03:00
jakkdl 753df941da
harmonize stringify_exception, various comments 2025-02-21 13:01:57 +01:00
jakkdl 09d06fe99d
fix tests 2025-02-20 17:14:43 +01:00
jakkdl 2c8cd64d5f
make pytest.raises use RaisesExc... which made me notice about a million small things differing between raises and RaisesExc, and some random other stuff... 2025-02-20 16:38:02 +01:00
jakkdl ff9dd38a7a
sed s/RaisesGroups/RaisesGroup 2025-02-18 16:29:54 +01:00
jakkdl 9e38a9ed2c
fix another import 2025-02-18 16:00:09 +01:00
jakkdl 4d2c70911b
fix imports after file rename 2025-02-18 15:16:36 +01:00
jakkdl ad6542ec77
Merge remote-tracking branch 'origin/main' into raisesgroup 2025-02-18 15:11:26 +01:00
dependabot[bot] 7d73ace975
build(deps): Bump pytest-django in /testing/plugins_integration (#13231)
Bumps [pytest-django](https://github.com/pytest-dev/pytest-django) from 4.9.0 to 4.10.0.
- [Release notes](https://github.com/pytest-dev/pytest-django/releases)
- [Changelog](https://github.com/pytest-dev/pytest-django/blob/main/docs/changelog.rst)
- [Commits](https://github.com/pytest-dev/pytest-django/compare/v4.9.0...v4.10.0)

---
updated-dependencies:
- dependency-name: pytest-django
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-17 06:43:55 +01:00
Harmin Parra Rueda d126389308
Add 'int' and 'float' ini option types
Fixes #11381

---------

Co-authored-by: Bruno Oliveira <bruno@soliv.dev>
Co-authored-by: Florian Bruhin <me@the-compiler.org>
2025-02-15 16:30:12 -03:00
dependabot[bot] 2a8593c701
build(deps): Bump django in /testing/plugins_integration (#13210)
Bumps [django](https://github.com/django/django) from 5.1.5 to 5.1.6.
- [Commits](https://github.com/django/django/compare/5.1.5...5.1.6)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-10 08:45:39 +01:00
Florian Bruhin a3d55a6955
Make pygments mandatory and fix string highlighting (#13189)
* Make pygments dependency required

Closes #7683

* Also highlight comparisons between strings

Fixes #13175
2025-02-08 17:07:57 +01:00
jakkdl c011e9b6f3 fix test, fix references in docstrings 2025-02-06 17:12:56 +01:00
jakkdl e73c4111d2 fix test on py<311 2025-02-06 15:52:56 +01:00
jakkdl e1e1874cda rename AbstractMatcher -> AbstractRaises, Matcher->RaisesExc. Add docs on RaisesGroup&RaisesExc. Add warnings to group_contains. Remove group_contains example from getting-started page 2025-02-06 15:39:25 +01:00
jakkdl 4737c8cf95 add AbstractMatcher support to xfail 2025-02-04 15:33:06 +01:00
jakkdl c93130c1b9 add RaisesGroup & Matcher 2025-02-04 13:31:23 +01:00
jakkdl 857daa8081 disable gc within the subprocess 2025-02-04 12:20:26 +01:00
Virendra Patil afdf03bc23
Fixed invalid regex handling in filterwarnings (#13124)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2025-02-03 14:49:08 +01:00
Florian Bruhin b4009b3197
Add readline workaround for libedit (#13176)
* Add readline workaround for libedit

We had a very similar workaround before for pyreadline, which had a similar
issue:

- Introduced in #1281
- Removed in #8848 for #8733 and #8847

This technically will regress the issues above, but those issues just mean that
`import readline` is broken in general, so the user should fix it instead (by
e.g. uninstalling pyreadline).

Fixes #12888
Fixes #13170

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Handle no readline on Windows

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-02-03 14:46:28 +01:00
dependabot[bot] 31fd03a67e
build(deps): Bump pytest-asyncio in /testing/plugins_integration (#13185)
Bumps [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) from 0.25.2 to 0.25.3.
- [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases)
- [Commits](https://github.com/pytest-dev/pytest-asyncio/compare/v0.25.2...v0.25.3)

---
updated-dependencies:
- dependency-name: pytest-asyncio
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-03 06:08:27 +01:00
Ammar Askar a0e3a49f19
Add basic implementation of PEP657 style expression markers in tracebacks (#13102)
* Add very basic implementation of PEP657 style line markers in tracebacks

* Version guard the py3.11 attributes

* Change version guard to make mypy happy. Also, stop using private traceback function

* Version guard unit test

* Fix repr cycle test

* Add changelog entry

* Add pragma no cover for branch where column info is missing
2025-01-26 20:15:14 -08:00
Kenny Y d471aef984 Fix sequences being shortened even with `-vv` verbosity.
Fix #11777
2025-01-26 09:29:11 -03:00
Kenny Y 6c9939b08b Add --force-short-summary option
This option allows the users to always see the "short test summary" section regardless of the verbosity level.

Fix #12713
2025-01-26 09:29:11 -03:00
Tobias Alex-Petersen ecff0babe9
Accept generic ExceptionGroups for raises (#13134)
* Accept generic ExceptionGroups for raises

Closes #13115

* Fix review suggestions

* Add extra test, changelog improvement

* Minor suggested refactor of if clause (review comment)

---------

Co-authored-by: Bruno Oliveira <bruno@pytest.org>
2025-01-23 17:39:17 -08:00
Emil Hjelm b89c1ce279
Add confval ``console_output_style`` option ``times`` (#13126)
Fixes #13125

---------

Co-authored-by: Bruno Oliveira <bruno@soliv.dev>
2025-01-20 12:27:21 -03:00
dependabot[bot] f93da9228d
build(deps): Bump django in /testing/plugins_integration (#13146)
Bumps [django](https://github.com/django/django) from 5.1.4 to 5.1.5.
- [Commits](https://github.com/django/django/compare/5.1.4...5.1.5)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-20 07:04:23 +01:00
Bruno Oliveira 2fcaa79358 Show cache age instead of update date 2025-01-15 14:48:06 -03:00
Bruno Oliveira 0c30a58060 Show cache information and reset cache if test count changes 2025-01-14 06:41:25 -03:00
Bruno Oliveira b6f1dadeb2 Tighten test 2025-01-14 06:41:25 -03:00
Bruno Oliveira 40b38f97c9 Add --stepwise-reset to restart the stepwise workflow 2025-01-14 06:41:25 -03:00
Bruno Oliveira 43064f5b61 Improve stepwise to not forget failed tests
Now `--stepwise` will remember the last failed test, even if the previous pytest invocations did not pass `--stepwise`.

Previously it would always clear the cache if not active, which hinders certain interactive workflows, which is the prime use cases for the flag.
2025-01-14 06:41:25 -03:00
dependabot[bot] 7d721d2b93
build(deps): Bump pytest-asyncio in /testing/plugins_integration (#13121)
Bumps [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) from 0.25.0 to 0.25.2.
- [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases)
- [Commits](https://github.com/pytest-dev/pytest-asyncio/compare/v0.25.0...v0.25.2)

---
updated-dependencies:
- dependency-name: pytest-asyncio
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-11 22:18:11 +01:00
Pierre Sassoulas 8826bb822f [style] Use '<' or '>=' for 'sys.version_info' comparisons 2025-01-11 08:12:44 +01:00