Ran Benita
1a16bac131
Merge pull request #11315 from bluetech/pytest-monkeypatch-chdir
...
pytester: use `monkeypatch.chdir()` for dir changing
2023-09-25 12:10:14 +03:00
Ran Benita
81192ca85f
pytester: use monkeypatch.chdir() for dir changing
...
The current method as the following problem, described by Sadra
Barikbin:
The tests that request both `pytester` and `monkeypatch` and use
`monkeypatch.chdir` without context, relying on `monkeypatch`'s teardown
to restore cwd. This doesn't work because the following sequence of
actions take place:
- `monkeypatch` is set up.
- `pytester` is set up. It saves the original cwd and changes it to a
new one dedicated to the test function.
- Test function calls `monkeypatch.chdir()` without context.
`monkeypatch` saves cwd, which is not the original one, before
changing it.
- `pytester` is torn down. It restores the cwd to the original one.
- `monkeypatch` is torn down. It restores cwd to what it has saved.
The solution here is to have pytester use `monkeypatch.chdir()` itself,
then everything is handled correctly.
2023-09-25 11:31:09 +03:00
Ran Benita
486a9ed057
Merge pull request #11464 from pytest-dev/update-plugin-list/patch-d2b214220
...
[automated] Update plugin list
2023-09-24 16:03:45 +03:00
Ran Benita
4ae102c003
Merge pull request #11446 from bluetech/pluggy-typing
...
Improve pluggy-related typing
2023-09-24 15:42:58 +03:00
pytest bot
c614590ec9
[automated] Update plugin list
2023-09-24 00:18:30 +00:00
Warren Markham
d2b214220f
Add class docstring to NodeMeta ( #11427 )
2023-09-20 09:08:07 -03:00
Simon Blanchard
a38ad254ef
Handle ValueError raised during faulthandler teardown code ( #11453 )
...
Fixes #11439
2023-09-20 09:06:43 -03:00
pre-commit-ci[bot]
9f22d3281c
[pre-commit.ci] pre-commit autoupdate ( #11451 )
...
updates:
- [github.com/asottile/reorder-python-imports: v3.10.0 → v3.11.0](https://github.com/asottile/reorder-python-imports/compare/v3.10.0...v3.11.0 )
- [github.com/asottile/pyupgrade: v3.10.1 → v3.11.0](https://github.com/asottile/pyupgrade/compare/v3.10.1...v3.11.0 )
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-09-19 11:51:41 +02:00
Sharad Nair
9a58e6283d
Fixes issue #11314 - log_file_format does not default to log_format ( #11444 )
...
* Fixes issue #11314 -
* Incorporated review comments for issue #11314
* Update changelog/11314.improvement.rst
Co-authored-by: Bruno Oliveira <bruno@soliv.dev>
---------
Co-authored-by: Zac Hatfield-Dodds <zac.hatfield.dodds@gmail.com>
Co-authored-by: Bruno Oliveira <bruno@soliv.dev>
2023-09-18 16:50:04 +00:00
github-actions[bot]
8bac8d7807
[automated] Update plugin list ( #11443 )
...
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2023-09-18 13:20:47 -03:00
dependabot[bot]
5e081162df
build(deps): Bump pytest-html in /testing/plugins_integration ( #11449 )
...
Bumps [pytest-html](https://github.com/pytest-dev/pytest-html ) from 4.0.1 to 4.0.2.
- [Release notes](https://github.com/pytest-dev/pytest-html/releases )
- [Changelog](https://github.com/pytest-dev/pytest-html/blob/master/docs/changelog.rst )
- [Commits](https://github.com/pytest-dev/pytest-html/compare/4.0.1...4.0.2 )
---
updated-dependencies:
- dependency-name: pytest-html
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>
2023-09-18 11:10:48 -03:00
Chris Mahoney
8062743f6b
Change deprecated_call to handle FutureWarning ( #11448 )
...
Fixes #11447
2023-09-18 09:34:05 -03:00
Zac Hatfield-Dodds
8b7f94f145
Merge pull request #11424 from lanzz/exceptioninfo-groupcontains
2023-09-17 16:51:57 -07:00
Mihail Milushev
5ace48ca5b
Fix a minor mistake in docs ("``match`` method" is actually talking about the `match` keyword parameter)
2023-09-17 22:28:32 +01:00
Mihail Milushev
e7caaa0b3e
Document the new `ExceptionInfo.group_contains()` method
2023-09-17 22:28:32 +01:00
Mihail Milushev
a47fcb4873
code review: kwarg-only `match`, replace `recursive` with `depth`
2023-09-17 22:28:32 +01:00
Mihail Milushev
ab8f5ce7f4
Add new `ExceptionInfo.group_contains` assertion helper method
...
Tests if a captured exception group contains an expected exception.
Will raise `AssertionError` if the wrapped exception is not an exception group.
Supports recursive search into nested exception groups.
2023-09-17 22:28:32 +01:00
Ran Benita
f43a8db618
Improve pluggy-related typing
2023-09-17 21:32:55 +03:00
pomponchik
6c2feb75d2
Add flask_fixture to the manual plugin list
...
Fixes #11435
2023-09-12 19:17:20 -03:00
pre-commit-ci[bot]
fcb8e73288
[pre-commit.ci] pre-commit autoupdate ( #11434 )
...
updates:
- [github.com/psf/black: 23.7.0 → 23.9.1](https://github.com/psf/black/compare/23.7.0...23.9.1 )
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-09-12 08:37:19 -03:00
Bruno Oliveira
241f2a890e
Force terminal width when running tests ( #11425 )
...
Related to #11423
2023-09-11 09:22:56 -03:00
dependabot[bot]
39f9306357
build(deps): Bump pytest-html in /testing/plugins_integration ( #11431 )
...
Bumps [pytest-html](https://github.com/pytest-dev/pytest-html ) from 4.0.0 to 4.0.1.
- [Release notes](https://github.com/pytest-dev/pytest-html/releases )
- [Changelog](https://github.com/pytest-dev/pytest-html/blob/master/docs/changelog.rst )
- [Commits](https://github.com/pytest-dev/pytest-html/compare/4.0.0...4.0.1 )
---
updated-dependencies:
- dependency-name: pytest-html
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>
2023-09-11 06:50:46 -03:00
dependabot[bot]
e0d04bdfab
build(deps): Bump django in /testing/plugins_integration ( #11430 )
...
Bumps [django](https://github.com/django/django ) from 4.2.4 to 4.2.5.
- [Commits](https://github.com/django/django/compare/4.2.4...4.2.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>
2023-09-11 06:50:32 -03:00
dependabot[bot]
1949b09fd3
build(deps): Bump actions/checkout from 3 to 4 ( #11429 )
...
Bumps [actions/checkout](https://github.com/actions/checkout ) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases )
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md )
- [Commits](https://github.com/actions/checkout/compare/v3...v4 )
---
updated-dependencies:
- dependency-name: actions/checkout
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>
2023-09-11 06:50:08 -03:00
Ran Benita
3d1c52f203
Merge pull request #11428 from ShurikMen/fix_tests_signature
...
Fix invalid signature in TestSorting tests
2023-09-11 10:30:45 +03:00
Aleksandr Brodin
a60c23c3d8
fix invalid signature
2023-09-11 09:59:00 +07:00
github-actions[bot]
24a6ee1ffd
[automated] Update plugin list ( #11422 )
...
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2023-09-10 13:09:41 +00:00
Bruno Oliveira
e2acc1a99b
Fix --import-mode=importlib when root contains `__init__.py` file ( #11420 )
...
We cannot have an empty module name when importing a `__init__.py` file that
is at the rootdir.
Fixes #11417
2023-09-10 09:57:40 -03:00
Warren Markham
71f265f1f3
Refactor: use division operator to join paths ( #11413 )
...
Starting with `resolve_package_path` and its associated tests,
this refactoring seeks to make path concatenation more
readable and consistent within tests/functions.
As discussed in #11413 :
- code is free to use either `/` and `joinpath`
- consistency within a function is more important than consistency across the codebase
- it is nice to use `/` when it is more readable
- it is nice to use `joinpath` when there is little context
- be mindful that `joinpath` may be clearer when joining multiple segments
2023-09-09 09:16:22 -03:00
Marc Mueller
7259e8db98
Fix assert rewriting with assignment expressions ( #11414 )
...
Fixes #11239
2023-09-09 09:09:31 -03:00
Ronny Pfannschmidt
dd7beb39d6
Merge pull request #11416 from bluetech/fixtures-getfixtureclosure
...
fixtures: more tweaks
2023-09-08 19:48:34 +02:00
Ran Benita
6ad9499c9c
doctest: some missing type annotations
2023-09-08 15:59:17 +03:00
Ran Benita
2ed2e9208d
doctest: remove unnecessary Optionals
2023-09-08 15:59:17 +03:00
Ran Benita
ab63ebb3dc
doctest: inline `_setup_fixtures`, make more similar to `Function`
...
There used to be two callers to `_setup_fixtures()`, now there's only
one, so inline it and make `DoctestItem` more similar to `Function`.
(Eventually we may want to generalize `TopRequest` from taking
`Function` directly to some "fixture-supporting item", removing the
remaining `type: ignore` here and allowing plugins to do it in a stable
manner).
2023-09-08 15:59:17 +03:00
Ran Benita
b3a981d385
fixtures: remove `getfixtureinfo(funcargs)` in favor of None `func`
...
Since we already broke plugins using this (private) interface in this
version (pytest-play, pytest-wdl), might as well do a cleanup.
2023-09-08 15:59:17 +03:00
Sadra Barikbin
48b0395648
fixtures: clean up getfixtureclosure()
...
Some code cleanups - no functional changes.
2023-09-08 15:53:49 +03:00
Ran Benita
9c11275553
fixtures: change getfixtureclosure(ignore_args) to a set
...
Only used for containment checks so a Set is more appropriate than a
list.
2023-09-08 15:53:49 +03:00
Bruno Oliveira
e5c81fa41a
Adjustments to the release process ( #11410 )
...
As discussed in #11408 :
* Improve documentation for the release process.
* Fix the description for the PRs created by the `prepare release pr` workflow.
* Fix pushing tag in the `deploy` workflow.
2023-09-08 07:22:16 -03:00
Bruno Oliveira
0a06db0729
Merge pull request #11408 from pytest-dev/release-7.4.2 ( #11409 )
...
Prepare release 7.4.2
(cherry picked from commit b0c4775a28aebcd3d3d6394ebb36838df01f809d)
2023-09-07 16:10:19 -03:00
Bruno Oliveira
5936a79fdb
Use _pytest.pathlib.safe_exists in get_dirs_from_args ( #11407 )
...
Related to #11394
2023-09-07 15:44:47 -03:00
Bruno Oliveira
28ccf476b9
Fix crash when passing a very long cmdline argument ( #11404 )
...
Fixes #11394
2023-09-07 12:49:25 -03:00
Fraser Stark
333e4eba6b
Change PytestReturnNotNoneWarning to return a normal warning ( #11211 )
...
Fixes #10465
2023-09-07 15:11:59 +00:00
Ronny Pfannschmidt
e787d2ed48
Merge pull request #11317 from tjsmart/fix-issue-11237
...
Fix doctest collection of `functools.cached_property` objects.
2023-09-07 14:39:02 +02:00
Florian Bruhin
f6b6478868
doc: Remove done training ( #11399 )
2023-09-06 15:22:27 +02:00
Stefaan Lippens
3ce63bc768
Improve plugin list disclaimer ( #11397 )
...
Closes #11391
2023-09-06 07:34:38 -03:00
Ran Benita
faa8f2ea08
Merge pull request #11393 from pytest-dev/fixtures-tweaks
...
Fixtures tweaks
2023-09-06 09:15:28 +03:00
Bruno Oliveira
194a782e38
Fix import_path for packages ( #11390 )
...
For packages, `import_path` receives the path to the package's `__init__.py` file, however module names (as they live in `sys.modules`) should not include the `__init__` part.
For example, `app/core/__init__.py` should be imported as `app.core`, not as `app.core.__init__`.
Fix #11306
2023-09-05 19:42:40 -03:00
Ran Benita
bc71561ad9
python: avoid an Any
2023-09-05 22:32:46 +03:00
Ran Benita
574e0f45d9
fixtures: avoid using the mildly expensive `fixturenames` property
...
Avoid creating a list copy + 2 sets + a linear search through the list
(in the common case).
2023-09-05 22:15:37 +03:00
Ran Benita
b8906b29a7
fixtures: require `item.fixturenames` to exist in `_fillfixtures`
...
I could find 2 plugins that would be broken by this (pytest-play and
pytest-wdl), but they will be better served by just copying
`_fillfixtures` instead of use the private function.
2023-09-05 22:15:37 +03:00