Commit Graph

15314 Commits

Author SHA1 Message Date
github-actions[bot] 4deb38b2ed
[automated] Update plugin list (#11329)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2023-08-21 13:19:58 +00:00
Ran Benita 370eacd3ca
doc/reference: replace Unicode dashes with ascii `-` in cli flags (#11323) 2023-08-21 14:40:03 +02:00
DetachHead 010e1742d8
use python 3.11 for update-plugin-list (#11328) 2023-08-21 12:29:41 +00:00
Ran Benita 6e5f10b28f
Merge pull request #11320 from ubaumann/add_nuts
add nuts to plugin list
2023-08-21 14:50:31 +03:00
pre-commit-ci[bot] dd5ae0c3b8 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2023-08-21 08:03:06 +00:00
DetachHead fc653d0d12
use `if not TYPE_CHECKING` on `pytest.__getattr__` to prevent type checkers from using it 2023-08-21 18:00:28 +10:00
Tyler Smart a357c7abc8 Ignore dip in branch coverage (since py3.13+ isn't tested in CI) 2023-08-20 20:55:30 -06:00
Reagan Lee 61133ba83d un-iterable fix 2023-08-20 14:46:09 -07:00
Reagan Lee 049eec8474 Revert iter raises checks
This reverts commit e938580257.

Revert "improve error msg and test"

This reverts commit c0cf822ca1.

Revert "error msg"

This reverts commit ec1053cc16.

Revert "changelog"

This reverts commit d2dc8a70b5.

Revert "simplify code / take out user-gen typeerror case"

This reverts commit b9cb87d862.
2023-08-20 14:06:42 -07:00
Ran Benita 37bb186175
Merge pull request #11322 from bluetech/testing-norecursedirs
testing: add `.*` to `norecursedirs`
2023-08-20 16:37:16 +03:00
Ran Benita 3cb3cd1a08 testing: add `.*` to `norecursedirs`
Setting `norecursedirs` overrides the default, so we end up scanning
dot-directories and such which slows down collection unnecessarily
(150ms on my working directory).
2023-08-20 12:16:38 +03:00
Tyler Smart 7a625481da PR suggestions 2023-08-19 22:20:40 -06:00
Ran Benita 0ddfdfcc04
Merge pull request #11321 from tjsmart/fix-doctesting
Add doctesting-coverage to envlist
2023-08-20 00:26:42 +03:00
Tyler Smart 87bfc83aa0 Add doctesting-coverage to envlist 2023-08-19 12:18:17 -06:00
Tyler Smart ebd571bb18 Move _from_module override to pre-existsing DocTestFinder subclass 2023-08-19 12:04:59 -06:00
ubaumann 176d728b7b
add nuts to plugin list
Adding https://github.com/network-unit-testing-system/nuts to the plugin list.
2023-08-18 23:34:40 +02:00
Tyler Smart d4fb6ac9f7 Fix doctest collection of `functools.cached_property` objects. 2023-08-16 00:55:16 -06:00
Ran Benita 15fadd8c5c
Merge pull request #11219 from bluetech/fixtures2
fixtures: make FixtureRequest abstract, add TopRequest subclass
2023-08-15 21:52:46 +03:00
pre-commit-ci[bot] 73d754bd74
[pre-commit.ci] pre-commit autoupdate (#11313)
updates:
- [github.com/pre-commit/mirrors-mypy: v1.4.1 → v1.5.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.4.1...v1.5.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-08-15 07:56:42 +00:00
Ran Benita 10056865d2
Merge pull request #11309 from bluetech/docs-xfail
doc: fix a few `xfail` nits
2023-08-12 18:58:37 +03:00
Ran Benita 1827d8d5f9 doc: fix a few `pytest.mark.xfail` nits
Refs #9027, #10094.
2023-08-12 18:30:58 +03:00
Ran Benita 9e164fc4fe fixtures: make FixtureRequest abstract, add TopRequest subclass
Fix #11218.
2023-08-12 11:55:08 +03:00
Reagan Lee c0cf822ca1 improve error msg and test 2023-08-11 10:33:34 -07:00
Reagan Lee ec1053cc16 error msg 2023-08-11 10:03:19 -07:00
Reagan Lee d2dc8a70b5 changelog 2023-08-11 09:48:53 -07:00
Reagan Lee b9cb87d862 simplify code / take out user-gen typeerror case 2023-08-10 17:43:01 -07:00
Reagan Lee e938580257 check for user-generated exceptions 2023-08-10 17:37:48 -07:00
Reagan Lee 47c0fc3d78 tests 2023-08-10 16:36:22 -07:00
Ran Benita 556e075d23
Merge pull request #11301 from bluetech/fixtures-resolve-directness
python: use clearer terminology for `_resolve_arg_value_types`
2023-08-10 09:05:58 +03:00
Ran Benita 3ad3fc6b8f python: use clearer terminology for `_resolve_arg_value_types` 2023-08-09 20:36:24 +03:00
Sadra Barikbin 09b78737a5
Move `fixtures.py::add_funcarg_pseudo_fixture_def` to `Metafunc.parametrize` (#11220)
To remove fixtures.py::add_funcargs_pseudo_fixture_def and add its logic
i.e. registering funcargs as params and making corresponding fixturedefs,
right to Metafunc.parametrize in which parametrization takes place.

To remove funcargs from metafunc attributes as we populate metafunc
params and make pseudo fixturedefs simultaneously and there's no need to
keep funcargs separately.
2023-08-09 17:13:45 +00:00
Ran Benita b2186e2455
Merge pull request #11268 from bluetech/conftest-load
config: split `_getconftestmodules` and `_loadconftestmodules`
2023-08-08 14:44:29 +03:00
Bruno Oliveira 18bc6c9a0e
Merge pull request #11292 from pytest-dev/dependabot/pip/testing/plugins_integration/django-4.2.4
build(deps): Bump django from 4.2.3 to 4.2.4 in /testing/plugins_integration
2023-08-07 08:15:17 -03:00
Bruno Oliveira 24c9aa6c30
Merge pull request #11291 from calestyo/improve-duplicate-values-documentation
Improve duplicate values documentation
2023-08-07 08:14:39 -03:00
dependabot[bot] 9c67b7aeb6
build(deps): Bump django in /testing/plugins_integration
Bumps [django](https://github.com/django/django) from 4.2.3 to 4.2.4.
- [Commits](https://github.com/django/django/compare/4.2.3...4.2.4)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-07 03:39:31 +00:00
Christoph Anton Mitterer 1cc58ed67f improve exception message on duplicate parametrization
Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
2023-08-06 17:43:37 +02:00
Christoph Anton Mitterer 84a342e27c doc: parametrize() can be called multiple times only on different args
Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
2023-08-06 17:39:31 +02:00
Sadra Barikbin e8a8a5f320
python: fix scope assignment for indirect parameter sets (#11277)
Previously, when assigning a scope for a fully-indirect parameter set,
when there are multiple fixturedefs for a param (i.e. same-name fixture
chain), the highest scope was used, but it should be the lowest scope,
since that's the effective scope of the fixture.
2023-08-06 13:59:54 +00:00
Florian Bruhin 1c04a92503
doc: Link pytest.main to how-to guide (#11287) 2023-08-06 12:39:11 +02:00
Christoph Anton Mitterer cc0adf6bf3
doc: update information about assertion messages (#11285)
It was pointed out[0] that the previous behaviour has been obsoleted by
commit 37bd1e03cb.

[0] https://github.com/pytest-dev/pytest/issues/11265#issuecomment-1666581197

Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
2023-08-05 19:30:41 +00:00
Christoph Anton Mitterer b8b74331b4
Improve docs for Parametrizing conditional raising (#11279)
What one typically actually wants in such a case is both, checking for some
resulting values *and* checking for some expected exception.

Since this is easily possible with the `nullcontext` context manager, adapt the
example accordingly (needlessly using a different name rather just confuses people).

Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
2023-08-03 13:31:17 -03:00
Sadra Barikbin 4797deab99
Add `FixtureArgKey` class to represent fixture deps in `fixtures.py` (#11231) 2023-08-02 14:28:31 +03:00
pre-commit-ci[bot] c9163402e0
[pre-commit.ci] pre-commit autoupdate (#11269)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/PyCQA/flake8: 6.0.0 → 6.1.0](https://github.com/PyCQA/flake8/compare/6.0.0...6.1.0)
- [github.com/asottile/pyupgrade: v3.9.0 → v3.10.1](https://github.com/asottile/pyupgrade/compare/v3.9.0...v3.10.1)

* Use is instead of type comparison with equal to appease the linter

---------

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>
2023-08-01 23:52:09 +02:00
Ran Benita 01ac13a77d config: split _getconftestmodules and _loadconftestmodules
Previously, the `_getconftestmodules` function was used both to load
conftest modules for a path (during `pytest_load_initial_conftests`),
and to retrieve conftest modules for a path (during hook dispatch and
for fetching `collect_ignore`). This made things muddy - it is usually
nicer to have clear separation between "command" and "query" functions,
when they occur in separate phases.

So split into "load" and "get".

Currently, `gethookproxy` still loads conftest itself. I hope to change
this in the future.
2023-08-01 09:46:17 +03:00
Ran Benita 485c555812
Merge pull request #11138 from bluetech/pkg-mod
python: change `Package` to no longer be a `Module`/`File`
2023-07-28 23:15:08 +03:00
Ran Benita a21fb87a90 python: change `Package` to no longer be a `Module`/`File`
Fix #11137.
2023-07-28 22:49:24 +03:00
Ran Benita c754da10d2
Merge pull request #11256 from bluetech/scope-pkg-crash
fixtures: fix crash when `parametrize(scope="package")` is used without a Package
2023-07-28 22:48:47 +03:00
Ran Benita 71e627aa8f fixtures: fix crash when `parametrize(scope="package")` is used without a Package
There as handling for `scope="class"` without a class, but not for
`scope="package"` without a package. It would fail the assert.
2023-07-28 16:13:02 +03:00
Uday Kumar d3552ef4c0
Clarify doc for running tests by nodeid section (#11249) 2023-07-28 07:06:38 +00:00
Ran Benita 448563caaa
Merge pull request #11253 from bluetech/11243-cherry-picks
11243 cherry picks
2023-07-27 10:19:40 +03:00