test_ok2/testing/plugins_integration
Ran Benita 992d0f082f fixtures: match fixtures based on actual node hierarchy, not textual nodeids
Refs #11662.

--- Problem

Each fixture definition has a "visibility", the `FixtureDef.baseid`
attribute. This is nodeid-like string. When a certain `node` requests a
certain fixture name, we match node's nodeid against the fixture
definitions with this name.

The matching currently happens on the *textual* representation of the
nodeid - we split `node.nodeid` to its "parent nodeids" and then check
if the fixture's `baseid` is in there.

While this has worked so far, we really should try to avoid textual
manipulation of nodeids as much as possible. It has also caused problem
in an odd case of a `Package` in the root directory: the `Package` gets
nodeid `.`, while a `Module` in it gets nodeid `test_module.py`. And
textually, `.` is not a parent of `test_module.py`.

--- Solution

Avoid this entirely by just checking the node hierarchy itself. This is
made possible by the fact that we now have proper `Directory` nodes
(`Dir` or `Package`) for the entire hierarchy.

Also do the same for `_getautousenames` which is a similar deal.

The `iterparentnodeids` function is no longer used and is removed.
2024-01-08 21:36:51 +02:00
..
.gitignore Smoke tests for assorted plugins (#7721) 2020-09-19 15:56:52 -03:00
README.rst Smoke tests for assorted plugins (#7721) 2020-09-19 15:56:52 -03:00
bdd_wallet.feature Smoke tests for assorted plugins (#7721) 2020-09-19 15:56:52 -03:00
bdd_wallet.py Smoke tests for assorted plugins (#7721) 2020-09-19 15:56:52 -03:00
django_settings.py Smoke tests for assorted plugins (#7721) 2020-09-19 15:56:52 -03:00
pytest.ini Setup strict asyncio mode 2022-01-23 23:07:28 +02:00
pytest_anyio_integration.py Smoke tests for assorted plugins (#7721) 2020-09-19 15:56:52 -03:00
pytest_asyncio_integration.py Smoke tests for assorted plugins (#7721) 2020-09-19 15:56:52 -03:00
pytest_mock_integration.py Smoke tests for assorted plugins (#7721) 2020-09-19 15:56:52 -03:00
pytest_trio_integration.py Smoke tests for assorted plugins (#7721) 2020-09-19 15:56:52 -03:00
pytest_twisted_integration.py Smoke tests for assorted plugins (#7721) 2020-09-19 15:56:52 -03:00
requirements.txt fixtures: match fixtures based on actual node hierarchy, not textual nodeids 2024-01-08 21:36:51 +02:00
simple_integration.py Smoke tests for assorted plugins (#7721) 2020-09-19 15:56:52 -03:00

README.rst

This folder contains tests and support files for smoke testing popular plugins against the current pytest version.

The objective is to gauge if any intentional or unintentional changes in pytest break plugins.

As a rule of thumb, we should add plugins here:

1. That are used at large. This might be subjective in some cases, but if answer is yes to
   the question: *if a new release of pytest causes pytest-X to break, will this break a ton of test suites out there?*.
2. That don't have large external dependencies: such as external services.

Besides adding the plugin as dependency, we should also add a quick test which uses some
minimal part of the plugin, a smoke test. Also consider reusing one of the existing tests if that's
possible.