runtraj.testing.run_stage#
- runtraj.testing.run_stage(stage, particles, release, directory, settings=None, others=None)[source]#
Run the stage at the import path stage in a project of one release, and check what a project relies on.
The project, in directory (an empty folder, such as pytest’s
tmp_path), has one release, one variant, andReplayModelas its transport model, which hands back particles as the release’s run. It is run asruntraj runruns it, in this process. It is for a stage that reads particles (runtraj.stages.Stage.result). Then this checks that:every simulation is complete: the particles, and the file of each stage;
the stage’s file is at
runtraj.Simulation.path(), where completion looks for it;a second run makes nothing again;
runtraj.stages.check_stage()holds for the stage’s settings as the variant resolved them.
- Parameters:
stage (
str) – The import path of the stage’s class, asconfig.yamlnames it.particles (
DataFrame) – The particle table of release, with the columns your stage reads (The Particle Table). Its most negative or positiveagesetsn_hours.release (runtraj.releases.Release) – The release the particles started from.
directory (
str|Path) – An empty folder for the project, its output, and the particles.settings (
Mapping[str,Any] |None) – The stage’s block understages:, withoutclass.others (
Mapping[str,Mapping[str,Any]] |None) – The blocks of the stages it reads, by name, each with itsclass.
- Returns:
The release’s simulation, to read the stage’s file with your own reader (
sim.path(<stage name>)).- Return type:
- Raises:
AssertionError – Saying what a project relies on that the stage broke, with the reason and message of a simulation that failed.