Commit Graph

15894 Commits

Author SHA1 Message Date
Ran Benita feaae2fb35
Merge pull request #12264 from bluetech/reraise-with-original-tb
fixtures,runner: fix tracebacks getting longer and longer
2024-04-29 20:02:44 +03:00
dependabot[bot] cf90008a1a
build(deps): Bump peter-evans/create-pull-request from 6.0.4 to 6.0.5 (#12268)
Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 6.0.4 to 6.0.5.
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](9153d834b6...6d6857d369)

---
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>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-29 08:38:05 -03:00
dj 2ede8778d0
Document using PYTEST_VERSION to detect if a code is running inside pytest (#12153)
Related to #9502
2024-04-28 15:52:29 -03:00
Ran Benita 2e1dfb0c16
Merge pull request #12265 from bluetech/pre-commit-tweaks
pre-commit tweaks
2024-04-28 17:52:38 +03:00
Ran Benita 940b78232e pre-commit: fix misleading indentation 2024-04-28 17:11:11 +03:00
Ran Benita e847b2a5a9 pre-commit: replace `debug-statements` hook with ruff
Ruff supports this functionality so we can use it.
2024-04-28 17:06:07 +03:00
Ran Benita 85bc9ca954 pre-commit: remove deprecated `fix-encoding-pragma` hook
Deprecated by pre-commit.
2024-04-28 17:06:07 +03:00
Ran Benita ebc4540436
Merge pull request #12258 from bluetech/xdist-align
terminal: fix progress percentages not aligning correctly in xdist
2024-04-28 16:52:40 +03:00
Ran Benita 3e81cb2f45 runner: fix tracebacks for failed collectors getting longer and longer
Refs https://github.com/pytest-dev/pytest/issues/12204#issuecomment-2081239376
2024-04-28 13:30:05 +03:00
Ran Benita 0b91d5e3e8 fixtures: fix tracebacks for higher-scoped failed fixtures getting longer and longer
Fix #12204.
2024-04-28 13:06:32 +03:00
Ran Benita 50d1e81713 terminal: fix progress percentages not aligning correctly in xdist
Fix #7166
2024-04-28 11:33:18 +03:00
Ran Benita 1a84d233f3 terminal: some minor code cleanups
No logical changed intended.
2024-04-28 11:33:18 +03:00
Ran Benita 127a372928
Merge pull request #12259 from bluetech/plain-raise
runner: avoid adding uninteresting entry to tracebacks
2024-04-28 11:21:15 +03:00
Bruno Oliveira 2a809e6f8b
Merge pull request #12261 from pytest-dev/update-plugin-list/patch-9eecdc7da
[automated] Update plugin list
2024-04-27 22:09:19 -03:00
pytest bot 852df0dc3e [automated] Update plugin list 2024-04-28 00:20:56 +00:00
Bruno Oliveira 9eecdc7dae
Merge pull request #12260 from nicoddemus/cherry-pick-release
Cherry-pick release pytest-dev/release-8.2.0
2024-04-27 20:41:36 -03:00
Bruno Oliveira 79ca819e59 Merge pull request #12257 from pytest-dev/release-8.2.0
Prepare release 8.2.0

(cherry picked from commit 69c3bcea36e1cf3468ac3cb92da9cf37038f959d)
2024-04-27 20:36:02 -03:00
Ran Benita fc5c960304 runner: avoid adding uninteresting entry to tracebacks
In these two cases which re-raise an immediately-caught exception, do
the re-raising with `raise` instead of `raise exc`, because the `raise
exc` adds an uninteresting entry to the exception's traceback (that of
itself), while `raise` doesn't.
2024-04-28 01:42:43 +03:00
Bruno Oliveira 835765c9d3
Merge pull request #12130 from bluetech/fixtures-inline
fixtures: inline some functions to streamline the code
2024-04-27 10:01:36 -03:00
Daniel Miller 7e7503c0b0
unittest: report class cleanup exceptions (#12250)
Fixes #11728

---------

Co-authored-by: Bruno Oliveira <bruno@soliv.dev>
2024-04-27 09:49:05 -03:00
Ran Benita 882c4da2f3 fixtures: inline `fail_fixturefunc`
Doesn't add much.
2024-04-27 09:48:14 -03:00
Ran Benita 2e8fb9f140 fixtures: extract a `_check_fixturedef` method
This stuff is less interesting when reading `_get_active_fixturedef`.
2024-04-27 09:48:14 -03:00
Ran Benita acf2971f46 fixtures: inline `_getnextfixturedef` into `_get_active_fixturedef` 2024-04-27 09:48:14 -03:00
Ran Benita 3c77aec1da fixtures: move "request" check early 2024-04-27 09:48:14 -03:00
Ran Benita d217d68cde fixtures: inline `_compute_fixture_value` 2024-04-27 09:48:14 -03:00
Ran Benita 530be28575 fixtures: use early return in `_get_active_fixturedef` 2024-04-27 09:48:14 -03:00
Bruno Oliveira d208c1d4a5
Merge pull request #12256 from bluetech/misc2
2 small cleanups
2024-04-27 09:39:16 -03:00
Ran Benita 80ca255d42 pathlib: make `absolutepath` support `os.PathLike[str]`
This slightly simplifies a bit of path.
2024-04-27 11:53:01 +03:00
Ran Benita 1a332802ff Avoid slicing `sys.version_info` in version conditionals
It is unnecessary, and some static analyzers don't handle it.
2024-04-27 01:14:21 +03:00
Bruno Oliveira 93c2cdf6d6
cherry-pick release-8.1.2 (#12252)
(cherry picked from commit 7df3dbc545b4b4deb2148683cd02f774b2d19fd8)
2024-04-26 15:25:44 -03:00
Shekhar verma 4eb8b6d525
Changed importError to ModuleNotFoundError (#12220)
* Changed importError to ModuleNotFoundError

* added testing for importorskip

* added exc_types parameter in importorskip

* Added warning and Test Cases

* Improve tests and docs

* Improve deprecation docs

* Change exc_type to kw only

* Apply suggestions from code review

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

* Fix check

---------

Co-authored-by: Bruno Oliveira <bruno@soliv.dev>
Co-authored-by: Florian Bruhin <me@the-compiler.org>
2024-04-26 09:48:57 +02:00
pre-commit-ci[bot] fafab1dbfd
[pre-commit.ci] pre-commit autoupdate (#12238)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.3.7 → v0.4.1](https://github.com/astral-sh/ruff-pre-commit/compare/v0.3.7...v0.4.1)
- [github.com/tox-dev/pyproject-fmt: 1.7.0 → 1.8.0](https://github.com/tox-dev/pyproject-fmt/compare/1.7.0...1.8.0)

* noqa a test

---------

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>
2024-04-23 11:59:12 -03:00
poulami-sau 5cffef7f07
Fixed Bug Regarding Attribute Error in pytest.approx For Types Implicitly Convertible to Numpy Arrays (#12232)
* added test case in testing/python/approx.py based on test case provided by reporter in issue #12114
* test cases pass for pytest testing/python/approx.py
* expanded the type annotation to include objects which may cast to a array and renamed other_side to other_side_as_array and asserted that it is not none
2024-04-23 10:45:33 +02:00
Florian Bruhin a830a3e98d
Update events/trainings (#12236) 2024-04-22 19:52:25 +02:00
dependabot[bot] 1d322ffb48
build(deps): Bump peter-evans/create-pull-request from 6.0.3 to 6.0.4 (#12233)
Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 6.0.3 to 6.0.4.
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](c55203cfde...9153d834b6)

---
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>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-22 11:54:48 +02:00
github-actions[bot] 63d985c6d3
[automated] Update plugin list (#12230)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2024-04-21 10:57:36 -03:00
Ran Benita 3617ef1c79
Merge pull request #12227 from bluetech/deprecate-legacy-path-impls
hookspec: deprecate hookimpls requesting py.path parameters
2024-04-21 11:52:16 +03:00
Ran Benita 58136c5376 hookspec: deprecate hookimpls requesting py.path parameters 2024-04-21 11:37:56 +03:00
Bruno Oliveira 042625957a
Fully type annotate pathlib.py (#12229)
Add full type annotations to `pathlib.py` and remove the `allow-untyped-defs` directive.
2024-04-20 16:32:36 -03:00
Bruno Oliveira 6fb474a3eb
Refactor insert_missing_modules function (#12210)
Makes the logic more straightforward IMO.
2024-04-20 11:58:14 +00:00
Bruno Oliveira ff806b239e
importlib: set children as attribute of parent modules (#12208)
Now `importlib` mode will correctly set the imported modules as an attribute of their parent modules.

As helpfully posted on #12194, that's how the Python import module works so we should follow suit.

In addition, we also try to import the parent modules as part of the process of importing a child module, again mirroring how Python importing works.

Fix #12194
2024-04-20 11:31:33 +00:00
dj ad95d59d61
Use monkeypatch in test_pytest_version_env_var
Follow up to #12190
2024-04-18 23:05:29 -03:00
dj 48b6d18834
Add PYTEST_VERSION environment variable (#12190)
Among other things, it can be used to check if a code is running from within a pytest session.

Fixes #9502
2024-04-18 07:45:47 -03:00
pre-commit-ci[bot] 58844247f7
[pre-commit.ci] pre-commit autoupdate (#12218)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.3.5 → v0.3.7](https://github.com/astral-sh/ruff-pre-commit/compare/v0.3.5...v0.3.7)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-04-15 23:04:19 +00:00
dependabot[bot] b56b294f54
build(deps): Bump peter-evans/create-pull-request from 6.0.2 to 6.0.3 (#12215)
Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 6.0.2 to 6.0.3.
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](70a41aba78...c55203cfde)

---
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>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-15 13:08:38 -03:00
Ran Benita 6e248818b9
Merge pull request #12212 from pytest-dev/update-plugin-list/patch-089116bdf
[automated] Update plugin list
2024-04-15 17:59:30 +03:00
dependabot[bot] 0644e467fb
build(deps): Bump hynek/build-and-inspect-python-package (#12214)
Bumps [hynek/build-and-inspect-python-package](https://github.com/hynek/build-and-inspect-python-package) from 2.2.1 to 2.4.0.
- [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.2.1...v2.4.0)

---
updated-dependencies:
- dependency-name: hynek/build-and-inspect-python-package
  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-04-15 10:33:41 +02:00
pytest bot 5f6e825a26 [automated] Update plugin list 2024-04-14 00:21:52 +00:00
HolyMagician03-UMich 089116bdff
short test summary: do not truncate text when -vv is given
Fix #11777

---------

Co-authored-by: Bruno Oliveira <bruno@soliv.dev>
2024-04-10 08:07:18 -03:00
Ran Benita 1f001cd105
Merge pull request #12199 from tamird/mkdir-test-init
Add test for Cache.mkdir
2024-04-09 22:26:36 +03:00