Commit Graph

14775 Commits

Author SHA1 Message Date
Ran Benita 04bddfc655
Merge pull request #9547 from bluetech/refactor-idmaker
Refactor idmaker functions into class IdMaker
2022-01-27 10:46:08 +02:00
Tobias Deiminger b21b008118 Refactor idmaker functions into class IdMaker
This commit only refactors, it does not change or add functionality yet. Public
API is retained. Reason or refactoring:

User provided parameter IDs (e.g. Metafunc.parametrize(ids=...)) had so far
only been used to calculate a unique test ID for each test invocation. That
test ID was a joined string where each parameter contributed some partial ID.

We're soon going to reuse functionality to generate parameter keys for
reorder_items and FixtureDef cache. We will be interested in the partial
IDs, and only if they originate from explicit user information. Refactoring
makes logic and data accessible for reuse, and increases cohesion in general.
2022-01-26 15:42:34 +02:00
Ran Benita acd2034535 fixtures: document FixtureDef's attributes 2022-01-25 23:44:59 +02:00
Ran Benita 52fbf3dbaa fixtures: make code flow clearer
Make the two cases (direct/indirect fixture) clearer. The try-catch
forces the reader to jump around.
2022-01-25 22:44:04 +02:00
Ran Benita e6166ccc3c doc/reference: don't document `pytest.__version__` under "Marks" 2022-01-25 22:39:13 +02:00
Ran Benita 5c69eced6c
Merge pull request #9532 from bluetech/getdir-cache
config: avoid stat storm in _getconftestmodules
2022-01-25 16:21:44 +02:00
Akuli a17e708352
With -vv, display the full skip/xfail reason instead of "..." (#9537)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-01-25 10:33:22 -03:00
Anthony Sottile 382e3d346e
Merge pull request #9539 from pytest-dev/all-repos_autofix_flake8-typing-imports
upgrade flake8-typing-imports
2022-01-24 08:56:04 -05:00
Bruno Oliveira 2907252693
Merge pull request #9528 from SalmonMode/autouse-linearization-graph 2022-01-24 07:47:43 -03:00
Anthony Sottile 039c3a201d upgrade flake8-typing-imports
Committed via https://github.com/asottile/all-repos
2022-01-23 21:21:26 -05:00
Andrew Svetlov b9fc678770
Merge pull request #9538 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-asyncio-0.17.2
build(deps): Bump pytest-asyncio from 0.16.0 to 0.17.2 in /testing/plugins_integration
2022-01-23 23:23:53 +02:00
Andrew Svetlov 9ae64aae56
Setup strict asyncio mode 2022-01-23 23:07:28 +02:00
dependabot[bot] 7783fb1b1e
build(deps): Bump pytest-asyncio in /testing/plugins_integration
Bumps [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) from 0.16.0 to 0.17.2.
- [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases)
- [Commits](https://github.com/pytest-dev/pytest-asyncio/compare/v0.16.0...v0.17.2)

---
updated-dependencies:
- dependency-name: pytest-asyncio
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-23 20:37:56 +00:00
Ran Benita 00085391fb
Merge pull request #9518 from pytest-dev/dependabot/pip/testing/plugins_integration/anyio-curiotrio--3.5.0
build(deps): Bump anyio[curio,trio] from 3.4.0 to 3.5.0 in /testing/plugins_integration
2022-01-23 22:02:15 +02:00
Ran Benita bc296443bd
Merge pull request #9534 from pytest-dev/update-plugin-list/patch-bb5a4e2d6
[automated] Update plugin list
2022-01-23 21:46:43 +02:00
pytest bot dddadefa68 [automated] Update plugin list 2022-01-23 00:12:46 +00:00
Ran Benita aee04cd49f config: avoid stat storm in _getconftestmodules
Fix #9478.
2022-01-22 00:27:43 +02:00
Ran Benita bb5a4e2d63
Merge pull request #9531 from bluetech/misc
python: fix confused docstring of `Metafunc._resolve_arg_ids`
2022-01-21 17:24:56 +02:00
Ran Benita 471634d6bd python: fix confused docstring of `Metafunc._resolve_arg_ids`
The docstring (and function name itself) described things as if IDs are
being assigned to the argnames, but actually they're assigned to the
parameter sets.
2022-01-21 16:18:44 +02:00
Ran Benita 888026f7a6
Merge pull request #9171 from bluetech/optimize-keywords-init
Optimizations/fixes around Function `keywords`
2022-01-21 15:19:53 +02:00
Ran Benita 6d128cd52e python: use a more memory-friendly generator 2022-01-21 14:35:25 +02:00
Ran Benita 74571ba55f Add missing `keywords` type annotations 2022-01-21 14:35:25 +02:00
Ran Benita 456a2538ac python: optimize node keywords initialization
If we do the `update`s in the right order, we can avoid the `mark.name
not in self.keywords` check, since `self.keywords` starts out clean and
`update` will override previously set keywords.
2022-01-21 14:35:25 +02:00
Ran Benita 3c69bc919c python: remove broken/ineffectual keywords marks initialization
By my analysis, this deleted code block has no effect:

1. `self.keywords` is `update`d with `callspec.marks`.
2. `self.own_markers` is `update`d with `callspec.marks`.
3. `self.keywords` is `update`d with `self.own_markers`.

So together steps 2+3 completely undo step 1.
2022-01-21 14:35:24 +02:00
Ran Benita d9bcfa0c2b python: don't redundantly duplicate parent markers to own keywords
This does have a slight semantic change: in a node hierarchy parent ->
child, if parent has a marker applied, then child is constructed, then
`parent.themarker = "overridden"`, previously
`child.keywords['themarker']` would return `True`, now it returns
`"overridden"`. But that's actually what I would have expected so I see
it as more of a bugfix.
2022-01-21 14:34:27 +02:00
Ran Benita 8713c32462 python: unpacked marks need to be added to keywords on all node types
(except `Instance`)

Currently, `Function` does this manually, but other node types don't get
their markers added to their `keywords`, but they should, if only for
consistency.
2022-01-21 14:34:27 +02:00
Ran Benita e9bb1aa233 python: be consistent with what value marks have in keywords
Marks are added to keywords in three places:

- `Node.add_marker`: name -> `Mark`
- `Function.__init__(callspec)`: name -> `Mark`
- `Function.__init__ iter_markers`: name -> True

I think it should be consistent, which will also help with some upcoming
code cleaning. The `Mark` seems more useful than just a `True`, so
switch to that.
2022-01-21 14:34:27 +02:00
Ran Benita 4e5fb520b6 python: remove an unneeded normalize_mark_list call
`callspec.mark` is already `List[Mark]` so no need to normalize it.
2022-01-21 14:34:27 +02:00
Ran Benita 6672a10354 fixtures: use node.ihook instead of open-coding it 2022-01-21 14:29:47 +02:00
Bruno Oliveira 4c8fb6f0af
Merge pull request #9522 from holmanb/rewrite-test 2022-01-20 13:18:12 -03:00
Chris NeJame 1fd0dcd510 fix missing ref to flattened fixture order image 2022-01-19 09:26:07 -05:00
Brett Holman 3f44b4078c Add test coverage to test rewrite 2022-01-18 11:26:46 -07:00
dependabot[bot] c393f95c99
build(deps): Bump anyio[curio,trio] in /testing/plugins_integration
Bumps [anyio[curio,trio]](https://github.com/agronholm/anyio) from 3.4.0 to 3.5.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.4.0...3.5.0)

---
updated-dependencies:
- dependency-name: anyio[curio,trio]
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-17 03:02:30 +00:00
Bruno Oliveira fe1f0e5376
Merge pull request #9516 from pytest-dev/update-plugin-list/patch-a6310c20c
[automated] Update plugin list
2022-01-16 09:03:31 -03:00
pytest bot 947b5dbc47 [automated] Update plugin list 2022-01-16 00:13:41 +00:00
Ran Benita a6310c20c1
Merge pull request #9512 from bluetech/pluggy-private
testing: avoid private pluggy attributes in test
2022-01-14 18:09:10 +02:00
Ran Benita 3f4eab3f8f testing: avoid private pluggy attributes in test 2022-01-14 17:49:38 +02:00
Olga Matoula 2ad1b589af
Add docs on pytest.warns(None) deprecation (#9495)
* Add docs on pytest.warns(None) deprecation

* Add new section for common warnings use cases

* Fix references for warnings use cases

* Fix reference link
2022-01-13 18:32:22 +00:00
Bruno Oliveira e9ed4827a4
Merge pull request #9506 from eamanu/fix-9505 2022-01-13 13:52:09 -03:00
Emmanuel Arias 5c2d752e74
improve docs 2022-01-13 13:29:08 -03:00
Emmanuel Arias 0fe0b78a9f
Improve on configuration file docs section
To avoid confusions the part of that "the configuration file can
be locate on your tests folder" is removed.
2022-01-13 12:52:18 -03:00
Ran Benita f1aa7a25de
Merge pull request #9493 from bluetech/conftesting
Some conftest changes
2022-01-12 10:38:14 +02:00
Anthony Sottile 202e44b5e6
Merge pull request #9500 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2022-01-10 18:33:35 -05:00
pre-commit-ci[bot] 8891d1f449
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-mypy: v0.930 → v0.931](https://github.com/pre-commit/mirrors-mypy/compare/v0.930...v0.931)
2022-01-10 21:28:04 +00:00
Ran Benita a425f15330
Merge pull request #9494 from bluetech/instance-property
python: add back `instance` accessor to all python nodes, not just Function
2022-01-10 21:08:46 +02:00
Bruno Oliveira 610edd156e
Merge pull request #9497 from pytest-dev/dependabot/pip/testing/plugins_integration/django-4.0.1
build(deps): Bump django from 4.0 to 4.0.1 in /testing/plugins_integration
2022-01-10 07:58:56 -03:00
dependabot[bot] 0d5f52b127
build(deps): Bump django in /testing/plugins_integration
Bumps [django](https://github.com/django/django) from 4.0 to 4.0.1.
- [Release notes](https://github.com/django/django/releases)
- [Commits](https://github.com/django/django/compare/4.0...4.0.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-10 03:02:30 +00:00
Ran Benita 0995e84adb
Merge pull request #9492 from pytest-dev/update-plugin-list/patch-abe2a8f4e
[automated] Update plugin list
2022-01-09 13:14:03 +02:00
Ran Benita 161bc48117 config: get rid of _conftestpath2mod
It duplicates what PluginManager already knows, and no longer needed now
that symlinks are not resolved (see previous commit).
2022-01-09 12:33:45 +02:00
Ran Benita 0ef882364e config: stop resolving symlinks in conftest paths
This became the wrong thing to do since
322190fd84.
2022-01-09 12:33:45 +02:00