starling_sim.utils.testing

Module Contents

Functions

get_test_scenarios([models])

Enumerate test scenarios for the given models.

run_model_test(model, scenario[, pkg])

Run the given test scenario and compare outputs.

compare_scenario_outputs(simulation_scenario)

Compare test scenario outputs with files of the reference folder.

Attributes

SIMULATION_TEST_DATA_FOLDER

REFERENCE_OUTPUTS_FOLDER_NAME

starling_sim.utils.testing.SIMULATION_TEST_DATA_FOLDER = 'tests/simulation_test_data/'
starling_sim.utils.testing.REFERENCE_OUTPUTS_FOLDER_NAME = 'reference'
starling_sim.utils.testing.get_test_scenarios(models=None)

Enumerate test scenarios for the given models.

If models is not provided, enumerate scenarios for all models available.

/!It is expected that the data folder variable paths._DATA_FOLDER has already been modified to designate the test data folder.

Parameters:

models – list of model codes

Returns:

list of (model_code, scenario) models

starling_sim.utils.testing.run_model_test(model, scenario, pkg='starling_sim')

Run the given test scenario and compare outputs.

Outputs are compared to reference files stored in the scenario folder.

Parameters:
  • model – model code

  • scenario – scenario folder name

  • pkg – starling package (see –help or run.py)

Returns:

boolean indicating if test was successful

Raises:

ValueError if a problem occurs

starling_sim.utils.testing.compare_scenario_outputs(simulation_scenario)

Compare test scenario outputs with files of the reference folder.

Parameters:

simulation_scenario – SimulationScenario object

Raises:

ValueError if files don’t match