alunduil / alunduil/zfs-replicate
Every test module reaches its subject the same way
- Langage dominant
- Python
- Étoiles
- 24
- Forks
- 6
- Merge moyen
- 3 h 11 min
- PR mergées (30 j)
- 49
Description
## 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.
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- python
- Domaine
- documentation, testing
- Type d'issue
- Refactorisation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- Active
- Clarté
- À clarifier
- Accessibilité débutants
- 42/100