Commit Graph

15812 Commits

Author SHA1 Message Date
Linghao Zhang c650e3a94f
Add research item in doc (#12147) 2024-03-21 11:21:43 -03:00
Ran Benita 470edc5884
Merge pull request #12133 from pytest-dev/dependabot/github_actions/hynek/build-and-inspect-python-package-2.0.2
build(deps): Bump hynek/build-and-inspect-python-package from 2.0.1 to 2.0.2
2024-03-20 11:21:40 +02:00
Ran Benita 07a08028de
Merge pull request #12132 from pytest-dev/dependabot/github_actions/peter-evans/create-pull-request-6.0.2
build(deps): Bump peter-evans/create-pull-request from 6.0.0 to 6.0.2
2024-03-20 11:20:50 +02:00
Ran Benita 42d3960fea
Merge pull request #12131 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-rerunfailures-14.0
build(deps): Bump pytest-rerunfailures from 13.0 to 14.0 in /testing/plugins_integration
2024-03-20 11:20:09 +02:00
Sebastian Meyer e7bf216516
doc: add versionadded to `ExceptionInfo.group_contains` (#12141) 2024-03-19 19:54:26 -03:00
pre-commit-ci[bot] 532782a228
[pre-commit.ci] pre-commit autoupdate (#12137)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.3.2 → v0.3.3](https://github.com/astral-sh/ruff-pre-commit/compare/v0.3.2...v0.3.3)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-03-18 22:51:23 +00:00
dependabot[bot] bf8b088bbe
build(deps): Bump hynek/build-and-inspect-python-package
Bumps [hynek/build-and-inspect-python-package](https://github.com/hynek/build-and-inspect-python-package) from 2.0.1 to 2.0.2.
- [Release notes](https://github.com/hynek/build-and-inspect-python-package/releases)
- [Changelog](https://github.com/hynek/build-and-inspect-python-package/blob/main/CHANGELOG.md)
- [Commits](https://github.com/hynek/build-and-inspect-python-package/compare/v2.0.1...v2.0.2)

---
updated-dependencies:
- dependency-name: hynek/build-and-inspect-python-package
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-18 03:12:49 +00:00
dependabot[bot] 027464975f
build(deps): Bump peter-evans/create-pull-request from 6.0.0 to 6.0.2
Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 6.0.0 to 6.0.2.
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](b1ddad2c99...70a41aba78)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-18 03:12:45 +00:00
dependabot[bot] 6be5c9d88c
build(deps): Bump pytest-rerunfailures in /testing/plugins_integration
Bumps [pytest-rerunfailures](https://github.com/pytest-dev/pytest-rerunfailures) from 13.0 to 14.0.
- [Changelog](https://github.com/pytest-dev/pytest-rerunfailures/blob/master/CHANGES.rst)
- [Commits](https://github.com/pytest-dev/pytest-rerunfailures/compare/13.0...14.0)

---
updated-dependencies:
- dependency-name: pytest-rerunfailures
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-18 03:02:28 +00:00
Ran Benita 2607fe8b47
Merge pull request #12126 from pytest-dev/update-plugin-list/patch-70c11582a
[automated] Update plugin list
2024-03-17 21:22:45 +02:00
pytest bot 2e69f31444 [automated] Update plugin list 2024-03-17 00:20:04 +00:00
John Litborn 70c11582aa
Don't add fixture finalizer if the value is cached (#11833)
Fixes #1489
2024-03-16 23:45:56 +02:00
Ran Benita c203f1615c
Merge pull request #12121 from jakkdl/test_scope_fixture_caching
Add tests to ensure setup&finalization for scoped fixtures only run once.
2024-03-16 12:21:53 +02:00
jakkdl bec0e9caf8 Add tests to ensure setup&finalization for scoped fixtures only run once. 2024-03-15 12:26:28 +01:00
Tobias Stoeckmann 2e5da5d2fb
doc: fix typos (#12118)
* doc: add missing word

* doc: fix typos

Typos found with codespell
2024-03-14 16:36:11 +00:00
pre-commit-ci[bot] c0532dda18
[pre-commit.ci] pre-commit autoupdate (#12115)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
Co-authored-by: Ran Benita <ran@unusedvar.com>
2024-03-13 15:30:18 +02:00
Ran Benita 14437788f0
Merge pull request #12108 from pytest-dev/bluetech-patch-1
doc: add versionadded to `Stash` and `StashKey`
2024-03-11 18:36:16 +02:00
Ran Benita 7eaaf370bb
doc: add versionadded to `Stash` and `StashKey`
Fixes #12107
2024-03-11 18:22:16 +02:00
dependabot[bot] 6c9e107681
build(deps): Bump softprops/action-gh-release from 1 to 2 (#12106)
Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 1 to 2.
- [Release notes](https://github.com/softprops/action-gh-release/releases)
- [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md)
- [Commits](https://github.com/softprops/action-gh-release/compare/v1...v2)

---
updated-dependencies:
- dependency-name: softprops/action-gh-release
  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-03-11 11:48:06 -03:00
dependabot[bot] 122b43439c
build(deps): Bump django in /testing/plugins_integration (#12103)
Bumps [django](https://github.com/django/django) from 5.0.2 to 5.0.3.
- [Commits](https://github.com/django/django/compare/5.0.2...5.0.3)

---
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>
2024-03-11 07:05:41 +01:00
dependabot[bot] a29ea1bc32
build(deps): Bump pypa/gh-action-pypi-publish from 1.8.12 to 1.8.14 (#12105)
Bumps [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) from 1.8.12 to 1.8.14.
- [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases)
- [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/v1.8.12...v1.8.14)

---
updated-dependencies:
- dependency-name: pypa/gh-action-pypi-publish
  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>
2024-03-11 07:04:19 +01:00
Ran Benita 0a442a9599
doc/flaky: remove `box/flaky` plugin suggestion (#12100)
The plugin is abandoned and no longer working with new pytest versions.

I also reordered a bit to put pytest-rerunfailures first since it seems most maintained and is under pytest-dev.
2024-03-10 11:51:04 -03:00
Ran Benita 520ff29c07
Merge pull request #12096 from bluetech/staticmethod-instance
python: fix instance handling in static and class method tests
2024-03-10 16:29:06 +02:00
github-actions[bot] b777b05c0e
[automated] Update plugin list (#12098)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2024-03-10 09:57:13 -03:00
Ran Benita b90da34a86
Merge pull request #12095 from nicoddemus/cherry-pick-release
Cherry pick release 8.1.1
2024-03-09 19:39:15 +02:00
Ran Benita 0dc0360351 python: fix instance handling in static and class method tests
and also fixes a regression in pytest 8.0.0 where `setup_method` crashes
if the class has static or class method tests.

It is allowed to have a test class with static/class methods which
request non-static/class method fixtures (including `setup_method`
xunit-fixture). I take it as a given that we need to support this
somewhat odd scenario (stdlib unittest also supports it).

This raises a question -- when a staticmethod test requests a bound
fixture, what is that fixture's `self`?

stdlib unittest says - a fresh instance for the test.

Previously, pytest said - some instance that is shared by all
static/class methods. This is definitely broken since it breaks test
isolation.

Change pytest to behave like stdlib unittest here.

In practice, this means stopping to rely on `self.obj.__self__` to get
to the instance from the test function's binding. This doesn't work
because staticmethods are not bound to anything.

Instead, keep the instance explicitly and use that.

BTW, I think this will allow us to change `Class`'s fixture collection
(`parsefactories`) to happen on the class itself instead of a class
instance, allowing us to avoid one class instantiation. But needs more
work.

Fixes #12065.
2024-03-09 19:35:54 +02:00
Bruno Oliveira 140c777590 Merge pull request #12094 from pytest-dev/release-8.1.1
Prepare release 8.1.1

(cherry picked from commit abb0cf4922919e3554bd16e9fc540bc107289ee9)
2024-03-09 08:52:31 -03:00
Ran Benita 774f0c44e6 fixtures: only call `instance` property once in function
No need to compute the property multiple times.
2024-03-09 10:16:41 +02:00
Ran Benita 006058f1f9 fixtures: update outdated comment
No longer does unittest stuff. Also the rest of the sentence is not
really necessary for a docstring.
2024-03-09 10:16:41 +02:00
Ran Benita 437eb86edd
Merge pull request #12092 from bluetech/fixture-cleanup
fixtures: a few more cleanups
2024-03-09 08:55:37 +02:00
Levon Saldamli 9033d4d3ff
Parse args from file (#12085)
Co-authored-by: Ran Benita <ran@unusedvar.com>
Co-authored-by: Bruno Oliveira <bruno@soliv.dev>
2024-03-09 08:51:52 +02:00
Bruno Oliveira 2ccc73be9a
Merge pull request #12087 from nicoddemus/revert-path-deprecations
Revert legacy path removals
2024-03-08 20:06:47 -03:00
Ran Benita ff551b7685 fixtures: simplify a bit of code 2024-03-09 00:02:06 +02:00
Ran Benita f5de111357 fixtures: check scope mismatch in `getfixturevalue` already-cached case
This makes sure the scope is always compatible, and also allows using
`getfixturevalue` in `pytest_fixture_setup` so less internal magic.
2024-03-09 00:02:06 +02:00
Ran Benita 71671f60b5 fixtures: improve fixture scope mismatch message
- Separate the requesting from the requested.

- Avoid the term "factory", I think most people don't distinguish
  between "fixture" and "fixture function" (i.e. "factory") and would
  find the term "factory" unfamiliar.
2024-03-09 00:02:06 +02:00
Ran Benita a9d1f55a0f fixtures: simplify scope checking
There are two non-optimal things in the current way scope checking is
done:

- It runs on `SubRequest`, but doesn't use the `SubRequest's scope,
  which is confusing. Instead it takes `invoking_scope` and
  `requested_scope`.

- Because `_check_scope` is only defined on `SubRequest` and not
  `TopRequest`, `_compute_fixture_value` first creates the `SubRequest`
  only then checks the scope (hence the need for the previous point).

Instead, also define `_check_scope` on `TopRequest` (always valid), and
remove `invoking_scope`, using `self._scope` instead.
2024-03-09 00:02:06 +02:00
Ran Benita 83887c066b
Merge pull request #12089 from bluetech/unittest-obj
unittest: make `obj` work more like `Function`/`Class`
2024-03-08 20:50:27 +02:00
Ran Benita 4a8bd5f2e2
Merge pull request #12057 from pytest-dev/dependabot/github_actions/pypa/gh-action-pypi-publish-1.8.12
build(deps): Bump pypa/gh-action-pypi-publish from 1.8.11 to 1.8.12
2024-03-08 14:07:30 +02:00
Ran Benita 51595d9000
Merge pull request #12056 from pytest-dev/dependabot/pip/testing/plugins_integration/twisted-24.3.0
build(deps): Bump twisted from 23.10.0 to 24.3.0 in /testing/plugins_integration
2024-03-08 14:07:02 +02:00
Ran Benita 1a5e0eb71d unittest: make `obj` work more like `Function`/`Class`
Previously, the `obj` of a `TestCaseFunction` (the unittest plugin item
type) was the unbound method. This is unlike regular `Class` where the
`obj` is a bound method to a fresh instance.

This difference necessitated several special cases in in places outside
of the unittest plugin, such as `FixtureDef` and `FixtureRequest`, and
made things a bit harder to understand.

Instead, match how the python plugin does it, including collecting
fixtures from a fresh instance.

The downside is that now this instance for fixture-collection is kept
around in memory, but it's the same as `Class` so nothing new. Users
should only initialize stuff in `setUp`/`setUpClass` and similar
methods, and not in `__init__` which is generally off-limits in
`TestCase` subclasses.

I am not sure why there was a difference in the first place, though I
will say the previous unittest approach is probably the preferable one,
but first let's get consistency.
2024-03-08 14:03:26 +02:00
Bruno Oliveira 221097517b Add changelog entry for #12069 2024-03-07 19:50:33 -03:00
Bruno Oliveira dacee1f11d Revert "Remove deprecated py.path hook arguments"
This reverts commit a98f02d423.
2024-03-07 19:50:33 -03:00
Bruno Oliveira 303cd0d48a Revert "Remove deprecated py.path (`fspath`) node constructor arguments"
This reverts commit 6c89f9261c.
2024-03-07 19:50:33 -03:00
Bruno Oliveira 86945f9a1f
Rename 'testing' extra to 'dev' (#12052)
Minor, but seems `dev` is more standard for the development extras than `testing`, being the default for tools like `poetry`.
2024-03-07 19:12:19 -03:00
Bruno Oliveira 03e54712dd
Do not import duplicated modules with --importmode=importlib (#12074)
Regression brought up by #11475.
2024-03-04 12:44:56 -03:00
Bruno Oliveira 18c0e5075f
Merge pull request #12075 from nicoddemus/yank-8.1.0
Yank version 8.1.0
2024-03-04 12:21:12 -03:00
Bruno Oliveira 6ee02a3e6c Yank version 8.1.0
Related to #12069
2024-03-04 12:18:14 -03:00
Bruno Oliveira 0951cbc6e4
Merge pull request #12070 from RonnyPfannschmidt/lift
add myself as tidelifter
2024-03-04 10:01:53 -03:00
Ronny Pfannschmidt 37b3401091 add myself to tidelift 2024-03-04 12:59:54 +01:00
dependabot[bot] 13558b9f53
build(deps): Bump pypa/gh-action-pypi-publish from 1.8.11 to 1.8.12
Bumps [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) from 1.8.11 to 1.8.12.
- [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases)
- [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/v1.8.11...v1.8.12)

---
updated-dependencies:
- dependency-name: pypa/gh-action-pypi-publish
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-04 03:47:21 +00:00