Commit Graph

15824 Commits

Author SHA1 Message Date
Bruno Oliveira ffd727e9d6 Fix mention of the prefix for pytest plugins in `plugin_list` 2024-02-24 21:35:51 -03:00
pytest bot b6eb985d55 [automated] Update plugin list 2024-02-25 00:19:33 +00:00
Ran Benita affc652f1c
Merge pull request #12030 from bluetech/cherry-pick-release
Cherry pick 8.0.2 release notes
2024-02-25 00:31:52 +02:00
Ran Benita 7460b1aa31 Cherry pick 8.0.2 release notes
(cherry picked from commit e53f79893212391c0bada5f1628b977371a09434)
2024-02-25 00:25:49 +02:00
Patrick Lannigan 84bd31de64
New verbosity_test_case ini option (#11653)
Allow for the output of test case execution to be controlled independently from the application verbosity level. 

`verbosity_test_case` is the new ini setting to adjust this functionality.

Fix #11639
2024-02-24 16:27:54 -03:00
Ran Benita a2a9aa6cde
Merge pull request #12027 from bluetech/sys-last-exc
runner: add support for `sys.last_exc` for post-mortem debugging on Python>=3.12
2024-02-23 22:41:14 +02:00
robotherapist c09f74619b runner: add support for `sys.last_exc` for post-mortem debugging on Python>=3.12
Fix #11850
2024-02-23 15:59:32 +02:00
Ran Benita b510adf9ef
Merge pull request #12023 from bluetech/fixtures-cleanups-2
fixtures: remove an unneeded suppress
2024-02-23 15:35:17 +02:00
Ran Benita 93cd7ba857
Merge pull request #12022 from bluetech/revert-11721
Revert "Fix teardown error reporting when `--maxfail=1` (#11721)"
2024-02-23 15:34:32 +02:00
Bruno Oliveira 8d9b95dcdb
Fix collection of short paths on Windows (#11936)
Passing a short path in the command line was causing the matchparts check to fail, because ``Path(short_path) != Path(long_path)``.

Using ``os.path.samefile`` as fallback ensures the comparsion works on Windows when comparing short/long paths.

Fix #11895
2024-02-23 07:51:15 -03:00
Ran Benita ad651ddfce fixtures: remove an unneeded suppress
In `CallSpec2.setmulti` the `params` and `_arg2scope` dicts are always
set together.

Further, the `get_parametrized_fixture_keys` accesses `_arg2scope` for
all argnames without a check, which I think rules out that the code
protects against plugin shenanigans.

After removing the suppress, adjust the comment and code to make more
sense.
2024-02-23 11:51:49 +02:00
Ran Benita 00d9640abc Revert "Fix teardown error reporting when `--maxfail=1` (#11721)"
Fix #12021.
Reopens #11706.

This reverts commit 12b9bd5801.

This change caused a bad regression in pytest-xdist:
https://github.com/pytest-dev/pytest-xdist/issues/1024

pytest-xdist necessarily has special handling of `--maxfail` and session
fixture teardown get executed multiple times with the change.

Since I'm not sure how to adapt pytest-xdist myself, revert for now.

I kept the sticky `shouldstop`/`shouldfail` changes as they are good
ideas regardless I think.
2024-02-23 11:45:26 +02:00
Ran Benita 010ce2ab0f
Add typing to `from_parent` return values (#11916)
Up to now the return values of `from_parent` were untyped, this is an
attempt to make it work with `typing.Self`.
2024-02-22 23:35:57 -08:00
Eric Larson 1640f2e454
ENH: Improve warning stacklevel (#12014)
* ENH: Improve warning stacklevel

* TST: Add test

* TST: Ping

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

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

* MAINT: Changelog

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-02-22 22:11:05 -08:00
Bruno Oliveira 59e9a58cc9
Remove Anthony from Tidelift participants (#12020)
As discussed in the core development channels, @asottile asked to no longer be a Tidelift participant, at least for the time being.
2024-02-22 21:04:11 -03:00
Ran Benita 691d8fcafb
Merge pull request #12019 from bluetech/fixtures-simplify
fixtures: remove a no longer needed sort
2024-02-22 21:52:56 +02:00
Ben Leith c5c729e27a
Add --log-file-mode option to the logging plugin, enabling appending to log-files (#11979)
Previously, the mode was hard-coded to be "w" which truncates the file before logging.

Co-authored-by: Bruno Oliveira <bruno@soliv.dev>
2024-02-21 12:02:19 +00:00
Ran Benita 9bea1be215 fixtures: remove a no longer needed sort
Dicts these days preserve order, so the sort is no longer needed to
achieve determinism.

As shown by the `test_dynamic_parametrized_ordering` test, this can
change the ordering of items, but only in equivalent ways (same number
of setups/teardowns per scope), it will just respect the user's given
ordering better (hence `vxlan` items now ordered before `vlan` items
compared to the previous ordering).
2024-02-21 10:17:25 +02:00
Ran Benita 2007cf6296 fixtures: remove a level of indentation
A bit easier to follow.
2024-02-21 10:17:24 +02:00
Ran Benita 79def57cc6 python: small code cleanup 2024-02-21 10:17:24 +02:00
Ran Benita 8a410d0ba6
Merge pull request #12013 from bluetech/doctest-test
testing: add a regression test for `setup_module` + `--doctest-modules`
2024-02-20 22:22:01 +02:00
Ran Benita a37cff3ca8 testing: add a regression test for `setup_module` + `--doctest-modules`
Refs #12011 (only fails on 8.0.1, not main).
2024-02-20 09:36:00 +02:00
pre-commit-ci[bot] 95f21f96cc
[pre-commit.ci] pre-commit autoupdate (#12012)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.2.1 → v0.2.2](https://github.com/astral-sh/ruff-pre-commit/compare/v0.2.1...v0.2.2)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-02-19 21:36:03 -03:00
Bruno Oliveira 998fee1679
Clarify PytestPluginManager._is_in_confcutdir (#12007)
Follow up to #12006, let's put some comments clarifying `is_in_confcutdir` semantics, as this is not the first time someone misunderstands it.

Also removed an obsolete comment in `_loadconftestmodules`: we already set the `confcutdir` based on `rootdir`/`initfile` if not explicitly given.

Co-authored-by: Ran Benita <ran@unusedvar.com>
2024-02-18 17:27:47 -03:00
Bruno Oliveira 40011b838b
Allow Sphinx 7.x (#12002)
Thanks to https://github.com/pytest-dev/pytest/issues/11988#issuecomment-1950318888, the problem was our custom template.

The solution was to copy the template from Sphinx 7 and remove the header.
2024-02-18 07:21:05 -03:00
Bruno Oliveira b37696703b
Merge pull request #12003 from pytest-dev/update-plugin-list/patch-cefb3e227
[automated] Update plugin list
2024-02-17 22:35:26 -03:00
Bruno Oliveira abf6a60567 Fix 'pytest_' mention: it was being considered a rst reference 2024-02-17 22:21:30 -03:00
pytest bot 52da8dd66c [automated] Update plugin list 2024-02-18 00:19:26 +00:00
Bruno Oliveira cefb3e2277
Disallow Sphinx 6 and 7 (#12000)
Using Sphinx 6.x and 7.x the search bar disappears. Restrict to Sphinx 5.x for now until we find a solution.

Reverts #11568
Fixes #11988
2024-02-17 17:46:58 -03:00
Bruno Oliveira 5f241f388b
Revert sys.platform verification to simple comparison (#11998)
As the comment above it states, we need to keep the comparison simple so mypy can understand it, otherwise it will fail to properly handle this on Windows and will flag ``os.getuid()`` missing.
2024-02-17 16:10:21 -03:00
Ran Benita aebeb33137
Merge pull request #11996 from bluetech/getstatementrange-index-error
code: fix `IndexError` crash in `getstatementrange_ast`
2024-02-17 18:59:10 +02:00
Ran Benita 9f13d41d7b code: fix `IndexError` crash in `getstatementrange_ast`
Fix #11953.
2024-02-17 18:43:55 +02:00
Ran Benita 984478109f
Merge pull request #11995 from bluetech/cherry-pick-release
Cherry pick 8.0.1 release notes
2024-02-17 00:27:55 +02:00
Ran Benita 22b541e4eb Merge pull request #11993 from pytest-dev/release-8.0.1
Prepare release 8.0.1

(cherry picked from commit 68524d48586e7f8d070fc1146e5ff90e770d0382)
2024-02-17 00:11:27 +02:00
Ran Benita fbe18fc7a9
Merge pull request #11991 from bluetech/warns-fix
recwarn: fix pytest.warns handling of Warnings with multiple arguments
2024-02-16 14:29:19 +02:00
Reagan Lee 9b838f491f recwarn: fix pytest.warns handling of Warnings with multiple arguments
Fix #11906
2024-02-16 14:14:24 +02:00
Ran Benita 6ef0cf150a
Merge pull request #11959 from eerovaher/warn-message-type
Allow using `warnings.warn()` with a `Warning`
2024-02-16 14:00:37 +02:00
Eero Vaher 0475b1c925 Allow using `warnings.warn()` with Warnings
Test:

`warnings.warn()` expects that its first argument is a `str` or a
`Warning`, but since 9454fc38d3
`pytest.warns()` no longer allows `Warning` instances unless the first
argument the `Warning` was initialized with is a `str`. Furthermore, if
the `Warning` was created without arguments then `pytest.warns()` raises
an unexpected `IndexError`. The new tests reveal the problem.

Fix:

`pytest.warns()` now allows using `warnings.warn()` with a `Warning`
instance, as is required by Python, with one exception. If the warning
used is a `UserWarning` that was created by passing it arguments and the
first argument was not a `str` then `pytest.raises()` still considers
that an error. This is because if an invalid type was used in
`warnings.warn()` then Python creates a `UserWarning` anyways and it
becomes impossible for `pytest` to figure out if that was done
automatically or not.

[ran: rebased on previous commit]
2024-02-16 13:41:59 +02:00
Ran Benita dcf9da92be recwarn: minor style improvements
In preparation for next commit.
2024-02-16 13:41:27 +02:00
Ran Benita 8e56795b77
Merge pull request #11989 from bluetech/plugin-list-underscore
scripts/update-plugin-list: include packages starting with "pytest_" (underscore)
2024-02-16 13:01:25 +02:00
Ran Benita 718cd40015
Merge pull request #11920 from bluetech/warn-skip
recwarn: let base exceptions propagate through `pytest.warns` again
2024-02-16 12:22:52 +02:00
Ran Benita 288201b8f5 recwarn: let base exceptions propagate through `pytest.warns` again
Fix #11907.
2024-02-16 12:07:56 +02:00
Ran Benita c6313a06fb scripts/update-plugin-list: include packages starting with "pytest_" (underscore)
Fix #11985.
2024-02-16 12:03:38 +02:00
dependabot[bot] 5d7a5a9343
build(deps): Bump codecov/codecov-action from 3 to 4 (#11921)
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 3 to 4.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-14 16:11:30 -03:00
dependabot[bot] cbb5c82c39
build(deps): Bump peter-evans/create-pull-request from 5.0.2 to 6.0.0 (#11922)
Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 5.0.2 to 6.0.0.
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](153407881e...b1ddad2c99)

---
updated-dependencies:
- dependency-name: peter-evans/create-pull-request
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-14 16:11:20 -03:00
Bruno Oliveira acafd003aa
Consider pyproject.toml files for config if no other config files were found (#11962)
Today `pyproject.toml` is the standard for declaring a Python project root, so seems reasonable to consider it for the ini configuration (and specially `rootdir`) in case we do not find other suitable candidates.

Related to #11311
2024-02-14 16:08:45 -03:00
Bruno Oliveira 46e6fb12c7
Consider paths and pathlists relative to cwd in case of an absent ini-file (#11963)
Previously this would trigger an `AssertionError`.

While it could be considered a bug-fix, but given it now can be relied upon, it is probably better to consider it an improvement.

Fix #11311
2024-02-14 15:53:28 -03:00
Dave Hall fe7907d78c
Add `logot` to plugin list (#11972) 2024-02-14 15:50:34 -03:00
Ran Benita 5bb1363435
Merge pull request #11957 from bluetech/fix-session-collect-order
main: fix reversed collection order in Session
2024-02-13 09:44:13 +02:00
pre-commit-ci[bot] ca84327f15
[pre-commit.ci] pre-commit autoupdate (#11967)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.2.0 → v0.2.1](https://github.com/astral-sh/ruff-pre-commit/compare/v0.2.0...v0.2.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-02-13 06:19:40 +01:00