livery.workshop._pytest_layout¶
livery.workshop._pytest_layout ¶
The test layout rule the suite enforces at session start.
Test modules are named by their path (pytest's importlib mode, which
the project template sets), so two packages may both have a
tests/test_lifecycle.py. That leaves the tests directories off
sys.path; the template puts every package's tests directory on
pythonpath instead, one shared path, so a helper module in
packages/<dir>/tests/ starts with <dir>_ (dashes as
underscores) and two packages never ship the same helper name. A
session whose layout breaks that is refused before any test runs,
naming each module and the name it wants.
Functions:
| Name | Description |
|---|---|
offenders |
Helper modules under a package's |
pytest_sessionstart |
Refuse the session when a helper module lacks its package's prefix. |
Attributes:
| Name | Type | Description |
|---|---|---|
UNNAMED |
|
offenders ¶
Helper modules under a package's tests/ without their package's prefix.
Each entry is the module and the name it wants. A directory under
packages counts when it carries a workshop.toml; test files
and the files every directory may hold are never offenders. The
prefix is the package's path under packages/, so a package in
a group directory carries the group's name too
(extensions_widgets_).
Source code in packages/workshop/src/livery/workshop/_pytest_layout.py
pytest_sessionstart ¶
Refuse the session when a helper module lacks its package's prefix.