Pytest-odoo infrastructure
This directory contains the shared Odoo 18 pytest infrastructure used by the checked-in PMIVerse runners. It is implementation guidance, not a replacement for canonical PMIVerse testing policy.
Contents
pmiverse_odoo_addons.pyextendsodoo.addons.__path__from the active Odoo configuration for runner-only test collection.pmiverse_pytest_base.pyprovides shared pytest behavior.conftest.base.pyis the source template for addontests/conftest.py.pytest.base.iniis the source template for repository pytest configuration.coverage.addon.rccontains shared coverage settings.templates/contains test package, fixture, and smoke-test templates.
These files are copied or loaded by scripts under
../../scripts/test/. Tests of the infrastructure itself
live in ../../tests/.
Runner contract
The single-addon runner prepares the disposable database, installs the target
addon, disables automatic plugin loading, explicitly loads pytest-odoo, and
prefers a collection through odoo.addons.<addon>.tests. Tests must not install,
uninstall, or update modules from inside pytest.
Optional integration apps belong in the addon's tests/odoo_dependencies.txt, with
one Odoo addon name per line. Blank lines and full-line # comments are allowed.
The single-addon runner and its repository-runner caller install these test-only
dependencies automatically before pytest, only on disposable test_* databases.
Do not add optional apps to production manifest dependencies just to exercise tests.
Do not add Odoo addon directories directly to PYTHONPATH; an addon such as
calendar can shadow a Python standard-library module. Do not add
sys.modules aliases to addon source code to make collection work. The
runner-only namespace plugin exists to avoid both patterns.
Addon tests belong under <addon>/tests/, use the Odoo environment fixture for
ORM work, and carry the registered Odoo pytest marker. Smoke tests assert that
the runner-prepared addon is installed and available; they do not perform the
installation themselves.
Running tests
Use the PMIVerse runners, not raw pytest or odoo-bin as the normal
workflow:
../../docs/scripts/run_pytest_addon.mddocuments one addon.../../docs/scripts/run_pytest_repo.mddocuments focused multi-addon selection and the broader repository mode.../../docs/scripts/ensure_testing_scaffold.mddocuments template deployment into addon repositories.
The runners create and may drop PostgreSQL databases. Use disposable names with
the test_ prefix and select only the addons being worked on. A repository-wide
run requires explicit approval under canonical PMIVerse policy.
Generated .pytest_cache/ and __pycache__/ directories are local artifacts
and must not be committed.