alunduil / alunduil/zfs-replicate

Every test module reaches its subject the same way

Abierto
#679 0 comentarios 0 reacciones 0 asignados Ver en GitHub
enhancement
Lenguaje dominante
Python
Estrellas
24
Forks
6
Merge medio
3 h 11 min
PR fusionados (30 d)
49

Descripción

## User story

As a **contributor reading a test module**, I want **one way to reach the module under test**, so that **`sut` means the subject everywhere, and a reader can tell the subject from its collaborators at a glance**.

## Current workaround

The documented convention is `import zfs.replicate.foo.bar as sut`, with tests reaching through the alias. Ten of the suite's twenty test modules follow it. The other ten import the subject by symbol:

| Module | How it reaches the subject |
| --- | --- |
| `compress_test/command_test.py` | `from zfs.replicate.compress.command import command` |
| `filesystem_test/destroy_test.py` | `from zfs.replicate.filesystem.destroy import destroy` |
| `optional_test.py` | `from zfs.replicate import optional` |
| `snapshot_test/destroy_test.py` | `from zfs.replicate.snapshot.destroy import destroy` |
| `snapshot_test/list_test.py` | `from zfs.replicate.snapshot.list import _snapshot, _snapshots` |
| `snapshot_test/send_test.py` | `from zfs.replicate.snapshot.send import Pipeline, _pipeline, _send, send` |
| `snapshot_test/type_test.py` | `from zfs.replicate.snapshot.type import Snapshot` |
| `task_test/execute_test.py` | `from zfs.replicate.task.execute import execute` |
| `task_test/generate_test.py` | `from zfs.replicate.task.generate import generate` |
| `task_test/report_test.py` | `from zfs.replicate.task import report` |

An even split is worth reading as a result rather than as neglect. Either the convention has never been enforced and drifted, or it does not pay for itself and half the suite has quietly voted. The alias earns most where a test patches the subject's own attributes, and least where the subject is one pure function the test calls once.

## Alternatives considered

- Convert the ten, so the documented convention holds everywhere.
- Narrow the convention to where it earns its keep, say where a test patches an attribute on the module under test, and document that boundary instead.
- Drop the convention and delete the claim.

Whichever way it goes, the reference and the suite should stop disagreeing.

## Acceptance criteria draft

- [ ] The suite reaches its subjects one way, or the convention names the cases where each way applies.
- [ ] Wherever the convention lives after #677, it describes what the suite does.
- [ ] Converted modules keep their assertions unchanged; this moves imports, not behaviour.

## Additional context

- #677 re-evaluates where this convention should live.
- #680 covers enforcing it once the suite agrees, since a check cannot go on while half the modules fail it.

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Start with #677 to understand where the test-import convention should live, then review the ten listed test modules and compare their imports with the documented `import ... as sut` pattern. Decide whether the suite should use one convention or document a boundary, then update the reference and imports as needed while keeping assertions unchanged. Check #680 for the intended enforcement follow-up.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python
Área
documentation, testing
Tipo de issue
Refactorización
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Activo
Claridad
Necesita aclaración
Aptitud para principiantes
42/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.