Commit Graph

15314 Commits

Author SHA1 Message Date
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
Ran Benita d2b5177dd6 fixtures: avoid some redundant work in `_fillfixtures` 2023-09-05 22:15:37 +03:00
Ran Benita 65c01f531b fixtures: use the item `fixturenames` in `request.fixturenames`
`_pyfuncitem.fixturenames` is just an alias for
`_pyfuncitem._fixtureinfo.names_closure` (at least in core pytest), so
let's do the less abstraction-breaking thing.
2023-09-05 22:15:37 +03:00
Ran Benita 82bd63d318 doctest: add `fixturenames` field to `DoctestItem`
The field is used in `_fillfixtures`, in preference to
`request.fixturenames`, which also includes already-computed which is
not needed.
2023-09-05 22:15:37 +03:00
Ran Benita d4872f5df7 fixtures: tiny code cleanup 2023-09-05 22:15:37 +03:00
Ran Benita 8d815ca55b python: type some CallSpec2 fields as immutable
Knowing that a field is immutable makes it easier to understand the
code.
2023-09-05 22:15:37 +03:00
pre-commit-ci[bot] 8032d21271
[pre-commit.ci] pre-commit autoupdate (#11389)
updates:
- [github.com/PyCQA/autoflake: v2.2.0 → v2.2.1](https://github.com/PyCQA/autoflake/compare/v2.2.0...v2.2.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-09-05 10:09:33 -03:00
dependabot[bot] 9c8937b480
build(deps): Bump pytest-html in /testing/plugins_integration (#11384)
Bumps [pytest-html](https://github.com/pytest-dev/pytest-html) from 3.2.0 to 4.0.0.
- [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/v3.2.0...4.0.0)

---
updated-dependencies:
- dependency-name: pytest-html
  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-04 08:08:10 -03:00
dependabot[bot] 0d8b87f161
build(deps): Bump anyio[curio,trio] in /testing/plugins_integration (#11383)
Bumps [anyio[curio,trio]](https://github.com/agronholm/anyio) from 3.7.1 to 4.0.0.
- [Release notes](https://github.com/agronholm/anyio/releases)
- [Changelog](https://github.com/agronholm/anyio/blob/master/docs/versionhistory.rst)
- [Commits](https://github.com/agronholm/anyio/compare/3.7.1...4.0.0)

---
updated-dependencies:
- dependency-name: anyio[curio,trio]
  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-04 08:08:01 -03:00
dependabot[bot] 65c73a09e7
build(deps): Bump twisted in /testing/plugins_integration (#11385)
Bumps [twisted](https://github.com/twisted/twisted) from 22.8.0 to 23.8.0.
- [Release notes](https://github.com/twisted/twisted/releases)
- [Changelog](https://github.com/twisted/twisted/blob/trunk/NEWS.rst)
- [Commits](https://github.com/twisted/twisted/compare/twisted-22.8.0...twisted-23.8.0)

---
updated-dependencies:
- dependency-name: twisted
  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-04 08:07:56 -03:00
Israel Fruchter 917ce9aa01
Fix user_properties not saved to XML if fixture errors during teardown
Move handling of user_properties to `finalize()`.

Previously if a fixture failed during teardown, `pytest_runtest_logreport` would not be called with "teardown", resulting in the user properties not being saved on the JUnit XML file.

Fixes: #11367
2023-09-03 14:33:54 -03:00
github-actions[bot] 4e3a0874df
[automated] Update plugin list (#11380)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2023-09-02 22:13:17 -03:00
Bruno Oliveira ba0da81f88
Merge pull request #11379 from nicoddemus/cherry-pick-release
Merge pull request #11377 from pytest-dev/release-7.4.1
2023-09-02 13:21:07 -03:00
Bruno Oliveira f08782d8d0 Merge pull request #11377 from pytest-dev/release-7.4.1
Prepare release 7.4.1

(cherry picked from commit 82eb86f707cac79f33d0ff69723ccf1cea7e75f7)
2023-09-02 12:45:58 -03:00
dependabot[bot] 5b528bd131
build(deps): Bump pypa/gh-action-pypi-publish from 1.8.8 to 1.8.10 (#11310)
Bumps [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) from 1.8.8 to 1.8.10.
- [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases)
- [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/v1.8.8...v1.8.10)

---
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>
2023-09-02 12:04:30 -03:00
Bruno Oliveira e4794b26b2
Merge pull request #11378 from nicoddemus/improve-ci-workflow
Improve CI workflow
2023-09-02 11:59:25 -03:00
Bruno Oliveira ab6cae2126 Improve CI workflow
* Build the package only once, and test on all platforms.
* Deploy is now triggered manually via an Action, which is then responsible for tagging the repository after the package has been uploaded successfully.
* Drop 'docs': we nowadays rely on readthedocs preview PR builds.
2023-09-02 10:29:02 -03:00
Sourabh Beniwal afb8d66e42
Update CONTRIBUTING.rst (#11368)
Chnaged Status: easy to good first issue, and updated the URL
2023-08-30 11:52:14 +00:00
Sean Patrick Malloy 76ba7db6ce
Improve docs for last-failed-no-failures
Improve documentation for last-failed-no-failures to make the different options and the functionality more clear.

Closes #11354
2023-08-29 00:14:45 +00:00
Ran Benita 941b203c94
Merge pull request #11360 from seanjedi/issue_11356-fixing-precommit-issue-with-flake8
fix: fixing an issue with pre-commit with mypy and flake8
2023-08-28 11:26:37 +03:00
Sean Malloy 19d6b12b2a fix: fixing an issue with pre-commit with mypy and flake8 2023-08-27 15:03:42 -07:00
github-actions[bot] 17e8f2b3fc
[automated] Update plugin list (#11358)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2023-08-27 11:29:17 -03:00
Warren Markham ff23347f1f
Fix platform-dependent type-check errors (#11345)
Use more explicit `sys.platform` checks, instead of the previous check using `in`, which mypy understands.

Fixes #11343
2023-08-27 09:40:24 -03:00
Ran Benita 00fedcc439
Merge pull request #11353 from bluetech/pluggy-typing
Fixes for typed pluggy
2023-08-26 22:59:35 +03:00
Ran Benita 77f7f59b2a Fixes for typed pluggy
Since version 1.3 pluggy added typing, which requires some fixes to
please mypy.
2023-08-26 22:13:24 +03:00
Jon Parise 7500fe44b2
Correct the spelling of ArgSource.INVOCATION_DIR (#11333)
Config.ArgsSource.INCOVATION_DIR remains as a backwards compatibility
alias.
2023-08-23 09:21:17 +00:00
Ha Pam 23b899f31f
Fix a typo in anatomy.rst (#11341) 2023-08-23 10:17:09 +02:00
Ran Benita 43d1398fc7
Merge pull request #11334 from WarrenTheRabbit/fix-docstring-spelling-in-pytester-1
doc: fix docstring spelling in pytester
2023-08-22 14:44:06 +03:00
Zac Hatfield-Dodds 03832fa31e
Merge pull request #11326 from DetachHead/DetachHead-patch-1
use `if not TYPE_CHECKING` on `pytest.__getattr__` to prevent type checkers from using it
2023-08-22 03:53:46 -07:00
pre-commit-ci[bot] 8f36fd5454
[pre-commit.ci] pre-commit autoupdate (#11335)
updates:
- [github.com/asottile/blacken-docs: 1.15.0 → 1.16.0](https://github.com/asottile/blacken-docs/compare/1.15.0...1.16.0)
- [github.com/pre-commit/mirrors-mypy: v1.5.0 → v1.5.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.5.0...v1.5.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-08-22 08:10:48 +00:00
DetachHead cada6c105a
ignore mypy error on deprecated `Instance` usage 2023-08-22 17:57:59 +10:00
WarrenTheRabbit 3f446b68fd
doc: fix docstring spelling in pytester 2023-08-22 14:36:39 +10:00
Zac Hatfield-Dodds 050f402816
Merge pull request #11308 from reaganjlee/iter-reporting
Improve reporting from __iter__ exceptions
2023-08-21 16:27:42 -07:00
Reagan Lee d1722d5c18 fix test for codecov 2023-08-21 15:49:39 -07:00