Commit Graph

15837 Commits

Author SHA1 Message Date
Ran Benita 5acc3f86ac
Merge pull request #12168 from tamird/fix-gitignore-missing
Initialize cache directory in isolation
2024-04-06 23:18:19 +03:00
Florian Bruhin 4e3dd21506
Improve stale bot messages (#12185)
To avoid confusion, see e.g. https://github.com/pytest-dev/pytest/issues/12123#issuecomment-2035283472

Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2024-04-04 00:24:34 +02:00
Tamir Duberstein 2e65f4e3ac
Initialize cache directory in isolation
Creating and initializing the cache directory is interruptible; this
avoids a pathological case where interrupting a cache write can cause
the cache directory to never be properly initialized with its supporting
files.

Unify `Cache.mkdir` with `Cache.set` while I'm here so the former also
properly initializes the cache directory.

Closes #12167.
2024-04-03 16:26:43 +01:00
Manuel López-Ibáñez cc588d1a1a
Doc: `import pytest` in `conftest.py` example in `doctest.rst` (#12181) 2024-04-03 09:02:09 -03:00
Ran Benita b63bea9523
Merge pull request #11910 from bluetech/move-show-fixtures
Move show-fixtures code from python.py to fixtures.py
2024-04-02 23:28:32 +03:00
Ran Benita a10ddad774
Merge pull request #12171 from pytest-dev/update-plugin-list/patch-12e061e2e
[automated] Update plugin list
2024-04-02 23:15:16 +03:00
Ran Benita 1188ea2608 Move show-fixtures code from python.py to fixtures.py
It makes more sense, also, we have a long term idea of generalizing
fixture support to items defined by other plugins, not just python, in
which case `--fixtures` would definitely not be python-plugin
specific.
2024-04-02 23:02:10 +03:00
Ran Benita aa5324560b
Merge pull request #12159 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-cov-5.0.0
build(deps): Bump pytest-cov from 4.1.0 to 5.0.0 in /testing/plugins_integration
2024-04-02 22:59:20 +03:00
Ronny Pfannschmidt 381593ccf0
Merge pull request #12176 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2024-04-02 08:41:02 +02:00
pre-commit-ci[bot] 9d6b5f8772
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.3.4 → v0.3.5](https://github.com/astral-sh/ruff-pre-commit/compare/v0.3.4...v0.3.5)
2024-04-01 22:13:25 +00:00
Pierre Sassoulas 44895289c7
Merge pull request #12170 from Pierre-Sassoulas/small-performance-improvments
Small performance/readability improvments when iterating dictionnary with ``keys()``
2024-03-31 15:15:03 +02:00
Pierre Sassoulas 1125296b53 Small performance/readability improvments when iterating dictionnary with ``keys()``
Based on pylint's message ``consider-iterating-dictionary`` suggestion.
Surprisingly using a dict or set comprehension instead of a new temp var is
actually consistently slower here, which was not intuitive for me.

```python
from timeit import timeit

families = {1: {"testcase": [1, 2, 3, 5, 8]}}
attrs = {1: "a", 2: "b", 3: "c", 4: "d", 5: "e", 6: "f", 7: "g", 8: "h"}

class Old:
    def old(self):
        self.attrs = attrs
        temp_attrs = {}
        for key in self.attrs.keys():
            if key in families[1]["testcase"]:
                temp_attrs[key] = self.attrs[key]
        self.attrs = temp_attrs

class OldBis:
    def old(self):
        self.attrs = attrs
        temp_attrs = {}
        for key in self.attrs:
            if key in families[1]["testcase"]:
                temp_attrs[key] = self.attrs[key]
        self.attrs = temp_attrs

class New:
    def new(self):
        self.attrs = attrs
        self.attrs = { # Even worse with k: v for k in self.attrs.items()
            k: self.attrs[k] for k in self.attrs if k in families[1]["testcase"]
        }

if __name__ == "__main__":
    n = 1000000
    print(f"Old: {timeit(Old().old, number=n)}")
    print(f"Just removing the keys(): {timeit(OldBis().old, number=n)}")
    print(f"List comp, no temp var: {timeit(New().new, number=n)}")
```

Result:
Old: 0.9493889989680611
Just removing the keys(): 0.9042672360083088
List comp, no temp var: 0.9916125109884888

It's also true for the other example with similar benchmark, but the exact
code probably does not need to be in the commit message.
2024-03-31 14:43:07 +02:00
Pierre Sassoulas bd9b62161a [tooling] Add a manual step to run pylint in pre-commit 2024-03-31 14:43:07 +02:00
John Litborn e64efd8653
Don't reregister subfixture finalizer in requested fixture if value is cached (#12136) 2024-03-31 15:02:09 +03:00
pytest bot 2dd58e827e [automated] Update plugin list 2024-03-31 00:20:45 +00:00
pre-commit-ci[bot] 12e061e2e8
[pre-commit.ci] pre-commit autoupdate (#12162)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.3.3 → v0.3.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.3.3...v0.3.4)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-03-25 23:37:36 +01:00
dependabot[bot] 5d345f6d7f
build(deps): Bump pytest-cov in /testing/plugins_integration
Bumps [pytest-cov](https://github.com/pytest-dev/pytest-cov) from 4.1.0 to 5.0.0.
- [Changelog](https://github.com/pytest-dev/pytest-cov/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest-cov/compare/v4.1.0...v5.0.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-25 06:32:55 +00:00
dependabot[bot] 2cba2237cd
build(deps): Bump pytest-twisted in /testing/plugins_integration (#12158)
Bumps [pytest-twisted](https://github.com/pytest-dev/pytest-twisted) from 1.14.0 to 1.14.1.
- [Release notes](https://github.com/pytest-dev/pytest-twisted/releases)
- [Commits](https://github.com/pytest-dev/pytest-twisted/compare/v1.14.0...v1.14.1)

---
updated-dependencies:
- dependency-name: pytest-twisted
  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-25 07:32:29 +01:00
dependabot[bot] e7b048e92d
build(deps): Bump pytest-mock in /testing/plugins_integration (#12160)
Bumps [pytest-mock](https://github.com/pytest-dev/pytest-mock) from 3.12.0 to 3.14.0.
- [Release notes](https://github.com/pytest-dev/pytest-mock/releases)
- [Changelog](https://github.com/pytest-dev/pytest-mock/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest-mock/compare/v3.12.0...v3.14.0)

---
updated-dependencies:
- dependency-name: pytest-mock
  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>
2024-03-25 07:30:45 +01:00
dependabot[bot] 4a8cefbf64
build(deps): Bump pytest-asyncio in /testing/plugins_integration (#12161)
Bumps [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) from 0.23.5 to 0.23.6.
- [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases)
- [Commits](https://github.com/pytest-dev/pytest-asyncio/compare/v0.23.5...v0.23.6)

---
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>
2024-03-25 07:30:08 +01:00
tserg 909759de2d
Improve sentence in marks documentation (#12157) 2024-03-24 15:59:07 +01:00
Ran Benita 85ff5d1b54
Merge pull request #12156 from pytest-dev/update-plugin-list/patch-c650e3a94
[automated] Update plugin list
2024-03-24 16:15:46 +02:00
Ran Benita cfc4cf074e
Merge pull request #12154 from bluetech/fixtures-cache-key-idx
fixtures: stop using `request.param_index` in fixture cache key
2024-03-24 15:40:52 +02:00
pytest bot aeae91e27d [automated] Update plugin list 2024-03-24 00:20:37 +00:00
Ran Benita 3eb16b34be fixtures: stop using `request.param_index` in fixture cache key
When `param` is not defined, `param_index` is always 0 (see
`_compute_fixture_value`), so no point in using it besides adding some
confusion.
2024-03-23 12:07:24 +02:00
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