Skip to content

IETS002: tests_init

The test directory and its sub-directories contain init.py.

Category: tests ยท Applies to: eval, helper

What it does

Checks <tests-root>/<name>/ and every directory beneath it for an __init__.py, ignoring cache directories. One diagnostic per directory. Skipped with tests-layout = "flat", the single-evaluation layout, whether the tests sit directly under the tests root or in a tests/<name>/ directory of their own: with one evaluation there is no second test tree to collide with. Also skipped for a helper package with no tests/<name>/ directory.

Why is this bad?

Per-evaluation test trees with duplicate module basenames (test_scorer.py in two evaluations) collide during pytest collection unless each tree is a package.

Options

  • tests-layout

Suppress on a line with # inspect-evals-lint: ignore[IETS002] -- <reason> or ignore[tests_init] -- <reason>; select or ignore it in configuration by either, or by the prefix IETS.