Architecture gates#
Built from the module docstrings of tests/unit/architecture/test_*.py and the YAML contracts beside them each time the site is built. Fix a wrong row there.
10 gate modules and 7 YAML contracts. Run them all with pytest tests/unit/architecture -q. The rule is the first paragraph of the module docstring; the checks are its test functions.
Gates#
Module |
Rule |
Contract |
Checks |
|---|---|---|---|
test_code_rules.py |
The code rules of the repository that a reader can check on the syntax alone. |
- |
|
test_layers.py |
Who reads whom: the layer matrix, the ports that stand alone, the string paths. |
|
|
test_package_layouts.py |
Enforce the import rules inside the packages that carry a |
|
|
test_public_import_paths.py |
Which import paths are public, and which port is stable. |
- |
|
test_run_path.py |
What the path of a run reads and writes. |
|
|
test_science_module_imports.py |
Rule 6: a science module imports numpy, the standard library and one neighbour of its folder. |
- |
|
test_surfaces.py |
What is public and held: surfaces, registers, tolerances, variables, exceptions. |
|
|
test_the_run_path_is_short.py |
A flow run plays fewer than forty files of hydromodpy/, listed one by one in run_path.toml. |
- |
|
test_the_stream_criterion_reads_once.py |
The stream criterion reads each of its inputs once, for the trial and the figure alike. |
- |
|
test_two_runs_in_two_threads.py |
Two runs in two threads of one process change nothing the other run reads (rule 15). |
|
|
Import rules inside a package#
layer_matrix.yaml treats each package as one block. A package whose parts are ordered carries a <package>_layout.yaml, checked by test_package_layouts.py. Parts are listed lowest first: a part may import only parts listed above it.
Contract |
Package |
Parts |
Other keys |
|---|---|---|---|
calibration_layout.yaml |
hydromodpy/calibration |
|
|
catchment_layout.yaml |
hydromodpy/catchment |
|
|
data_layout.yaml |
hydromodpy/data |
|
|
display_layout.yaml |
hydromodpy/display |
|
|
mesh_layout.yaml |
hydromodpy/mesh |
|
|
solver_layout.yaml |
hydromodpy/solver |
|
|