Pytest infrastructure plugin for collecting virtual generated tests.
The plugin adds a synthetic file named __test_generated__.py under the first collection directory from config.args and exposes a custom pytest hook, pytest_generate_virtual_tests.
Other plugins can implement that hook to return generated pytest.Item objects, usually pytest.Function items.
Generated tests are not backed by a real Python file, but they get a normal pytest parent chain and can use pytest fixtures when implemented as pytest.Function objects.
Classes | |
| class | _FakeModule |
| class | _GeneratedTestsDir |
| class | _GeneratedTestsDirectoryMixin |
| class | _GeneratedTestsFile |
| class | _GeneratedTestsPackage |
| class | GeneratedTestsPluginHooks |
| Custom pytest (pluggy) hooks customizing generated tests. More... | |
Functions | |
| None | pytest_addhooks (pytest.PytestPluginManager pluginmanager) |
| None | pytest_configure (pytest.Config config) |
| None | pytest_itemcollected (pytest.Item item) |
| pathlib.Path|None | _get_first_collection_directory (pytest.Config config) |
| pytest_collect_directory (pathlib.Path path, pytest.Collector parent) | |
| pytest.Directory | _create_wrapped_directory (*, pytest.Collector parent, pathlib.Path path) |
Variables | |
| bool | _IS_ARCADIA = True |
| str | _GENERATED_FILENAME = '__test_generated__.py' |
| _GENERATED_TESTS_DIR_KEY = pytest.StashKey[pathlib.Path | None]() | |
| _COLLECTED_ITEMS_KEY = pytest.StashKey[list[pytest.Item]]() | |
|
protected |
Definition at line 117 of file generated_tests.py.
|
protected |
Definition at line 79 of file generated_tests.py.
| None pytest_userver.plugins.generated_tests.pytest_addhooks | ( | pytest.PytestPluginManager | pluginmanager | ) |
Definition at line 56 of file generated_tests.py.
| pytest_userver.plugins.generated_tests.pytest_collect_directory | ( | pathlib.Path | path, |
| pytest.Collector | parent ) |
Definition at line 102 of file generated_tests.py.
| None pytest_userver.plugins.generated_tests.pytest_configure | ( | pytest.Config | config | ) |
Definition at line 60 of file generated_tests.py.
| None pytest_userver.plugins.generated_tests.pytest_itemcollected | ( | pytest.Item | item | ) |
Definition at line 69 of file generated_tests.py.
|
protected |
Definition at line 33 of file generated_tests.py.
|
protected |
Definition at line 30 of file generated_tests.py.
|
protected |
Definition at line 32 of file generated_tests.py.
|
protected |
Definition at line 26 of file generated_tests.py.