Skip to main content
← Back to kicad-monkey Rust Docs kicad-monkey Rust Crate API Reference

Module synthetics

Module synthetics 

Source
Expand description

Find KiCad Monkey’s synthetic test cases.

Synthetic cases are small KiCad projects authored for one feature. They live in git at tests/cases/<topic>/<case>/ in the KiCad Monkey source tree, and each one is a whole project:

  • input/ holds the .kicad_pro, the .kicad_sch and the .kicad_pcb (the board may be blank);
  • reference_output/ holds the checked-in kicad-cli references, when the case has any;
  • output/ is ignored by git and holds results for people to look at;
  • case_metadata.json describes the case, hashes its files and records the kicad-cli version that made the references.

WN_KICAD_SYNTHETICS names the folder that holds the topics. When it is unset or blank, the in-repo tests/cases folder is used, so the cases can move later by changing only the variable. Python has the same resolver, kicad_monkey.testing.synthetics, and the two behave alike.

Cases are shared test input: a test that runs kicad-cli (which writes a .kicad_prl next to any project it opens) or writes anything else copies the input to a temporary folder first.

Constants§

CASE_METADATA_FILE
The file that makes a <topic>/<case>/ folder a case.
SYNTHETICS_ENV
The environment variable that names the synthetic cases folder.

Functions§

default_synthetic_cases_root
tests/cases of the KiCad Monkey source tree this crate was built from.
iter_synthetic_cases
Enumerate every <topic>/<case>/ folder holding case_metadata.json, sorted by (topic, case). When topic is Some, filters to that topic.
resolve_synthetic_cases_root
The synthetic cases folder for a WN_KICAD_SYNTHETICS value.
synthetic_case
The <topic>/<case>/ folder, which holds case_metadata.json.
synthetic_cases_root
The synthetic cases folder that WN_KICAD_SYNTHETICS selects.