Skip to content

test-folder-imported (ODOO045)

Preview (since 0.16.2.2) · Related issues · View source

Derived from the odoo linter.

This rule is unstable and in preview. The --preview flag is required for use.

What it does

Checks for imports of the tests folder in a module's __init__.py.

Why is this bad?

Odoo discovers and loads tests on its own when running with --test-enable; importing the tests package from __init__.py loads test code (and its extra dependencies) in production too.

Example

from . import models, tests

Use instead:

from . import models