From 1fca8414056723623c037169483efb790f748b4a Mon Sep 17 00:00:00 2001 From: Jostein Solaas Date: Thu, 7 Nov 2024 22:12:27 +0100 Subject: [PATCH] chore: move tests outside src directory Use importlib import-mode for pytest. This requires shared code to be installed, which we solve by having a testing module in libecalc here. --- pyproject.toml | 4 + .../testing/__init__.py} | 0 .../testing}/yaml_builder.py | 78 +++---------------- {src/tests => tests}/conftest.py | 2 +- {src/tests => tests}/ecalc_cli/conftest.py | 0 .../test_component_name_csv/waterinj.csv | 0 .../test_component_name_json/waterinj.json | 0 .../waterinj.json | 0 .../test_app/test_csv_default/test.csv | 0 .../test_csv_resampled/results_resampled.csv | 0 .../test_csv_temporal_default/test.csv | 0 .../test_temporal.csv | 0 .../test_app/test_full_csv/results.csv | 0 .../test_full_simplified_json/results.json | 0 .../test_json_advanced_model_v3.json | 0 .../results_resampled.json | 0 .../test_app/test_json_true/test_v3.json | 0 .../test_full_json_v3.json | 0 .../test.INST_A.ltp.tsv | 0 .../test.INST_A.ltp.tsv.json | 0 .../test.MOBILE_HOST_FIELD.ltp.tsv | 0 .../test.MOBILE_HOST_FIELD.ltp.tsv.json | 0 .../test.MOBILE_SATELLITE_A.ltp.tsv | 0 .../test.MOBILE_SATELLITE_A.ltp.tsv.json | 0 .../test.MOBILE_SATELLITE_B.ltp.tsv | 0 .../test.MOBILE_SATELLITE_B.ltp.tsv.json | 0 .../test.POWER_FROM_SHORE_EVENT.ltp.tsv | 0 .../test.POWER_FROM_SHORE_EVENT.ltp.tsv.json | 0 .../test.INST_A.stp.tsv | 0 .../test.INST_A.stp.tsv.json | 0 .../test.MOBILE_HOST_FIELD.stp.tsv | 0 .../test.MOBILE_HOST_FIELD.stp.tsv.json | 0 .../test.MOBILE_SATELLITE_A.stp.tsv | 0 .../test.MOBILE_SATELLITE_A.stp.tsv.json | 0 .../test.MOBILE_SATELLITE_B.stp.tsv | 0 .../test.MOBILE_SATELLITE_B.stp.tsv.json | 0 .../test.POWER_FROM_SHORE_EVENT.stp.tsv | 0 .../test.POWER_FROM_SHORE_EVENT.stp.tsv.json | 0 .../test_app/test_valid/flow-diagram.json | 0 {src/tests => tests}/ecalc_cli/test_app.py | 0 .../ecalc_cli/test_cache.py | 0 .../ecalc_neqsim_wrapper/conftest.py | 0 .../integration_tests/test_gerg_fluid.py | 0 .../integration_tests/test_remove_liquid.py | 0 .../unit_tests/test_java_service.py | 0 .../unit_tests/test_neqsim_fluid.py | 0 .../libecalc/common/test_constants.py | 0 .../libecalc/common/test_dangerous.py | 0 .../libecalc/common/test_graph.py | 0 .../libecalc/common/test_list_utils.py | 0 .../libecalc/common/test_numbers.py | 0 .../libecalc/common/test_string_utils.py | 0 .../common/test_tabular_time_series.py | 0 .../libecalc/common/test_temporal_model.py | 0 .../libecalc/common/test_time_utils.py | 0 .../libecalc/common/test_unit.py | 0 .../libecalc/common/test_version.py | 0 .../libecalc/common/utils/test_adjustment.py | 0 .../test_compute_emission_intensity_yearly.py | 0 .../libecalc/common/utils/test_math_utils.py | 0 .../libecalc/common/utils/test_rates.py | 0 .../tests => tests}/libecalc/core/conftest.py | 0 .../libecalc/core/consumers/conftest.py | 0 .../test_consumer_function.py | 0 ...est_direct_expression_consumer_function.py | 0 .../core/consumers/system/conftest.py | 0 .../consumers/system/test_consumer_system.py | 0 .../system/test_operational_setting.py | 0 .../consumers/system/test_system_results.py | 0 .../consumers/system/test_system_utils.py | 0 .../core/consumers/test_consumer_utils.py | 0 .../libecalc/core/consumers/test_crossover.py | 0 .../libecalc/core/consumers/test_genset.py | 0 .../core/consumers/test_legacy_consumer.py | 0 .../core/models/chart/test_chart_curve.py | 0 .../models/chart/test_single_speed_chart.py | 0 .../models/chart/test_variable_speed_chart.py | 0 .../models/compressor_modelling/conftest.py | 0 .../input/compressor_sampled_3d_testdata3.csv | 0 .../compressor_sampled_3d_vsd_testdata.csv | 0 .../compressor_sampled_3d_vsd_testdata2.csv | 0 .../sampled/test_compressor_sampled.py | 0 .../sampled/test_compressor_sampled_1d.py | 0 .../sampled/test_compressor_sampled_2d.py | 0 .../sampled/test_compressor_sampled_3d.py | 0 .../sampled/test_convex_hull_common.py | 0 .../test_compressor_chart.py | 0 .../test_compressor_chart_generator.py | 0 .../test_compressor_model_vs_unisim.py | 0 .../test_compressor_train_base.py | 0 ...est_compressor_train_common_shaft_utils.py | 0 .../test_compressor_with_turbine.py | 0 .../models/compressor_modelling/test_fluid.py | 0 .../test_numeric_methods.py | 0 .../test_simplified_compressor_train.py | 0 ...gle_speed_compressor_train_common_shaft.py | 0 ...ble_speed_compressor_train_common_shaft.py | 0 ...speed_compressor_train_multiple_streams.py | 0 .../test_consumer_tabular_energy_function.py | 0 .../models/test_energy_function_results.py | 0 .../libecalc/core/models/test_fuel_model.py | 0 .../core/models/test_generator_model.py | 0 .../libecalc/core/models/test_pump.py | 0 .../libecalc/core/models/test_turbine.py | 0 .../core/models/test_validate_model_input.py | 0 .../libecalc/core/result/test_results.py | 0 .../libecalc/dto/results/model/test_extend.py | 0 .../test_requested_pressures_compressors.py | 0 .../libecalc/dto/test_composition.py | 0 .../libecalc/dto/test_electricity_consumer.py | 0 .../libecalc/dto/test_energy_model.py | 0 .../libecalc/dto/test_fuel_consumer.py | 0 .../libecalc/dto/test_generator_set.py | 0 .../libecalc/dto/utils/test_validators.py | 0 .../libecalc/expression/test_expression.py | 0 .../expression/test_expression_evaluator.py | 0 .../input/mappers/test_consumer_chart.py | 0 .../input/mappers/test_energy_usage_model.py | 0 .../input/mappers/test_facility_input.py | 0 .../input/mappers/test_model_mapper.py | 0 .../input/mappers/test_resolve_fuel.py | 0 .../libecalc/input/mappers/test_utils.py | 0 .../variables_mapper/test_timeseries.py | 0 .../variables_mapper/test_timeseries_utils.py | 0 .../variables_mapper/test_variables_mapper.py | 0 .../libecalc/input/test_create_references.py | 0 .../libecalc/input/test_file_io.py | 0 .../libecalc/input/test_validation_errors.py | 0 .../libecalc/input/test_yaml_configuration.py | 0 .../test_system_component_conditions.py | 0 .../input/yaml_types/test_yaml_variable.py | 0 ...ll_consumer_with_time_slots_models_v3.json | 0 .../all_energy_usage_models_v3.json | 0 .../consumer_system_v2.json | 0 ...est_all_consumer_with_time_slots_models.py | 0 .../test_all_energy_usage_models.py | 0 .../integration/test_consumer_system_v2.py | 0 .../integration/test_minimal_is_valid.py | 0 .../test_multiple_installations.py | 0 .../libecalc/output/flow_diagram/conftest.py | 0 .../all_energy_usage_models_fde.json | 0 .../test_case_with_dates/actual_fde.json | 0 .../flow_diagram/test_ecalc_model_mapper.py | 0 .../libecalc/output/test_frequencies.py | 0 .../exporter/formatters/test_csv_formatter.py | 0 .../exporter/handlers/test_handlers.py | 0 .../presentation/exporter/test_ltp.py | 0 .../json_result/test_aggregators.py | 0 .../presentation/simple_result/test_simple.py | 0 .../presentation/yaml/test_location.py | 0 .../presentation/yaml/test_venting_emitter.py | 0 .../test_venting_emitter_validation_errors.py | 0 .../presentation/yaml/test_yaml_model.py | 0 .../yaml_models/test_yaml_model_errors.py | 0 .../yaml/yaml_types/models/conftest.py | 42 ++++++++-- .../models/test_model_reference_validation.py | 0 .../test_yaml_simplified_compressor_train.py | 10 +-- ...test_yaml_single_speed_compressor_train.py | 5 +- ...st_yaml_variable_speed_compressor_train.py | 5 +- .../yaml/yaml_types/test_categories.py | 0 .../yaml/yaml_types/test_missing_files.py | 0 161 files changed, 57 insertions(+), 89 deletions(-) rename src/{tests/ecalc_cli/test_cache.py => libecalc/testing/__init__.py} (100%) rename src/{tests/libecalc => libecalc/testing}/yaml_builder.py (75%) rename {src/tests => tests}/conftest.py (99%) rename {src/tests => tests}/ecalc_cli/conftest.py (100%) rename {src/tests => tests}/ecalc_cli/snapshots/test_app/test_component_name_csv/waterinj.csv (100%) rename {src/tests => tests}/ecalc_cli/snapshots/test_app/test_component_name_json/waterinj.json (100%) rename {src/tests => tests}/ecalc_cli/snapshots/test_app/test_component_name_json_stdout/waterinj.json (100%) rename {src/tests => tests}/ecalc_cli/snapshots/test_app/test_csv_default/test.csv (100%) rename {src/tests => tests}/ecalc_cli/snapshots/test_app/test_csv_resampled/results_resampled.csv (100%) rename {src/tests => tests}/ecalc_cli/snapshots/test_app/test_csv_temporal_default/test.csv (100%) rename {src/tests => tests}/ecalc_cli/snapshots/test_app/test_csv_temporal_default/test_temporal.csv (100%) rename {src/tests => tests}/ecalc_cli/snapshots/test_app/test_full_csv/results.csv (100%) rename {src/tests => tests}/ecalc_cli/snapshots/test_app/test_full_simplified_json/results.json (100%) rename {src/tests => tests}/ecalc_cli/snapshots/test_app/test_json_advanced_model/test_json_advanced_model_v3.json (100%) rename {src/tests => tests}/ecalc_cli/snapshots/test_app/test_json_resampled/results_resampled.json (100%) rename {src/tests => tests}/ecalc_cli/snapshots/test_app/test_json_true/test_v3.json (100%) rename {src/tests => tests}/ecalc_cli/snapshots/test_app/test_json_true_detailed_output/test_full_json_v3.json (100%) rename {src/tests => tests}/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.INST_A.ltp.tsv (100%) rename {src/tests => tests}/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.INST_A.ltp.tsv.json (100%) rename {src/tests => tests}/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.MOBILE_HOST_FIELD.ltp.tsv (100%) rename {src/tests => tests}/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.MOBILE_HOST_FIELD.ltp.tsv.json (100%) rename {src/tests => tests}/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.MOBILE_SATELLITE_A.ltp.tsv (100%) rename {src/tests => tests}/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.MOBILE_SATELLITE_A.ltp.tsv.json (100%) rename {src/tests => tests}/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.MOBILE_SATELLITE_B.ltp.tsv (100%) rename {src/tests => tests}/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.MOBILE_SATELLITE_B.ltp.tsv.json (100%) rename {src/tests => tests}/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.POWER_FROM_SHORE_EVENT.ltp.tsv (100%) rename {src/tests => tests}/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.POWER_FROM_SHORE_EVENT.ltp.tsv.json (100%) rename {src/tests => tests}/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.INST_A.stp.tsv (100%) rename {src/tests => tests}/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.INST_A.stp.tsv.json (100%) rename {src/tests => tests}/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.MOBILE_HOST_FIELD.stp.tsv (100%) rename {src/tests => tests}/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.MOBILE_HOST_FIELD.stp.tsv.json (100%) rename {src/tests => tests}/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.MOBILE_SATELLITE_A.stp.tsv (100%) rename {src/tests => tests}/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.MOBILE_SATELLITE_A.stp.tsv.json (100%) rename {src/tests => tests}/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.MOBILE_SATELLITE_B.stp.tsv (100%) rename {src/tests => tests}/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.MOBILE_SATELLITE_B.stp.tsv.json (100%) rename {src/tests => tests}/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.POWER_FROM_SHORE_EVENT.stp.tsv (100%) rename {src/tests => tests}/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.POWER_FROM_SHORE_EVENT.stp.tsv.json (100%) rename {src/tests => tests}/ecalc_cli/snapshots/test_app/test_valid/flow-diagram.json (100%) rename {src/tests => tests}/ecalc_cli/test_app.py (100%) rename src/tests/libecalc/common/utils/test_compute_emission_intensity_yearly.py => tests/ecalc_cli/test_cache.py (100%) rename {src/tests => tests}/ecalc_neqsim_wrapper/conftest.py (100%) rename {src/tests => tests}/ecalc_neqsim_wrapper/integration_tests/test_gerg_fluid.py (100%) rename {src/tests => tests}/ecalc_neqsim_wrapper/integration_tests/test_remove_liquid.py (100%) rename {src/tests => tests}/ecalc_neqsim_wrapper/unit_tests/test_java_service.py (100%) rename {src/tests => tests}/ecalc_neqsim_wrapper/unit_tests/test_neqsim_fluid.py (100%) rename {src/tests => tests}/libecalc/common/test_constants.py (100%) rename {src/tests => tests}/libecalc/common/test_dangerous.py (100%) rename {src/tests => tests}/libecalc/common/test_graph.py (100%) rename {src/tests => tests}/libecalc/common/test_list_utils.py (100%) rename {src/tests => tests}/libecalc/common/test_numbers.py (100%) rename {src/tests => tests}/libecalc/common/test_string_utils.py (100%) rename {src/tests => tests}/libecalc/common/test_tabular_time_series.py (100%) rename {src/tests => tests}/libecalc/common/test_temporal_model.py (100%) rename {src/tests => tests}/libecalc/common/test_time_utils.py (100%) rename {src/tests => tests}/libecalc/common/test_unit.py (100%) rename {src/tests => tests}/libecalc/common/test_version.py (100%) rename {src/tests => tests}/libecalc/common/utils/test_adjustment.py (100%) create mode 100644 tests/libecalc/common/utils/test_compute_emission_intensity_yearly.py rename {src/tests => tests}/libecalc/common/utils/test_math_utils.py (100%) rename {src/tests => tests}/libecalc/common/utils/test_rates.py (100%) rename {src/tests => tests}/libecalc/core/conftest.py (100%) rename {src/tests => tests}/libecalc/core/consumers/conftest.py (100%) rename {src/tests => tests}/libecalc/core/consumers/consumer_function/test_consumer_function.py (100%) rename {src/tests => tests}/libecalc/core/consumers/consumer_function/test_direct_expression_consumer_function.py (100%) rename {src/tests => tests}/libecalc/core/consumers/system/conftest.py (100%) rename {src/tests => tests}/libecalc/core/consumers/system/test_consumer_system.py (100%) rename {src/tests => tests}/libecalc/core/consumers/system/test_operational_setting.py (100%) rename {src/tests => tests}/libecalc/core/consumers/system/test_system_results.py (100%) rename {src/tests => tests}/libecalc/core/consumers/system/test_system_utils.py (100%) rename {src/tests => tests}/libecalc/core/consumers/test_consumer_utils.py (100%) rename {src/tests => tests}/libecalc/core/consumers/test_crossover.py (100%) rename {src/tests => tests}/libecalc/core/consumers/test_genset.py (100%) rename {src/tests => tests}/libecalc/core/consumers/test_legacy_consumer.py (100%) rename {src/tests => tests}/libecalc/core/models/chart/test_chart_curve.py (100%) rename {src/tests => tests}/libecalc/core/models/chart/test_single_speed_chart.py (100%) rename {src/tests => tests}/libecalc/core/models/chart/test_variable_speed_chart.py (100%) rename {src/tests => tests}/libecalc/core/models/compressor_modelling/conftest.py (100%) rename {src/tests => tests}/libecalc/core/models/compressor_modelling/sampled/input/compressor_sampled_3d_testdata3.csv (100%) rename {src/tests => tests}/libecalc/core/models/compressor_modelling/sampled/input/compressor_sampled_3d_vsd_testdata.csv (100%) rename {src/tests => tests}/libecalc/core/models/compressor_modelling/sampled/input/compressor_sampled_3d_vsd_testdata2.csv (100%) rename {src/tests => tests}/libecalc/core/models/compressor_modelling/sampled/test_compressor_sampled.py (100%) rename {src/tests => tests}/libecalc/core/models/compressor_modelling/sampled/test_compressor_sampled_1d.py (100%) rename {src/tests => tests}/libecalc/core/models/compressor_modelling/sampled/test_compressor_sampled_2d.py (100%) rename {src/tests => tests}/libecalc/core/models/compressor_modelling/sampled/test_compressor_sampled_3d.py (100%) rename {src/tests => tests}/libecalc/core/models/compressor_modelling/sampled/test_convex_hull_common.py (100%) rename {src/tests => tests}/libecalc/core/models/compressor_modelling/test_compressor_chart.py (100%) rename {src/tests => tests}/libecalc/core/models/compressor_modelling/test_compressor_chart_generator.py (100%) rename {src/tests => tests}/libecalc/core/models/compressor_modelling/test_compressor_model_vs_unisim.py (100%) rename {src/tests => tests}/libecalc/core/models/compressor_modelling/test_compressor_train_base.py (100%) rename {src/tests => tests}/libecalc/core/models/compressor_modelling/test_compressor_train_common_shaft_utils.py (100%) rename {src/tests => tests}/libecalc/core/models/compressor_modelling/test_compressor_with_turbine.py (100%) rename {src/tests => tests}/libecalc/core/models/compressor_modelling/test_fluid.py (100%) rename {src/tests => tests}/libecalc/core/models/compressor_modelling/test_numeric_methods.py (100%) rename {src/tests => tests}/libecalc/core/models/compressor_modelling/test_simplified_compressor_train.py (100%) rename {src/tests => tests}/libecalc/core/models/compressor_modelling/test_single_speed_compressor_train_common_shaft.py (100%) rename {src/tests => tests}/libecalc/core/models/compressor_modelling/test_variable_speed_compressor_train_common_shaft.py (100%) rename {src/tests => tests}/libecalc/core/models/compressor_modelling/test_variable_speed_compressor_train_multiple_streams.py (100%) rename {src/tests => tests}/libecalc/core/models/test_consumer_tabular_energy_function.py (100%) rename {src/tests => tests}/libecalc/core/models/test_energy_function_results.py (100%) rename {src/tests => tests}/libecalc/core/models/test_fuel_model.py (100%) rename {src/tests => tests}/libecalc/core/models/test_generator_model.py (100%) rename {src/tests => tests}/libecalc/core/models/test_pump.py (100%) rename {src/tests => tests}/libecalc/core/models/test_turbine.py (100%) rename {src/tests => tests}/libecalc/core/models/test_validate_model_input.py (100%) rename {src/tests => tests}/libecalc/core/result/test_results.py (100%) rename {src/tests => tests}/libecalc/dto/results/model/test_extend.py (100%) rename {src/tests => tests}/libecalc/dto/results/model/test_requested_pressures_compressors.py (100%) rename {src/tests => tests}/libecalc/dto/test_composition.py (100%) rename {src/tests => tests}/libecalc/dto/test_electricity_consumer.py (100%) rename {src/tests => tests}/libecalc/dto/test_energy_model.py (100%) rename {src/tests => tests}/libecalc/dto/test_fuel_consumer.py (100%) rename {src/tests => tests}/libecalc/dto/test_generator_set.py (100%) rename {src/tests => tests}/libecalc/dto/utils/test_validators.py (100%) rename {src/tests => tests}/libecalc/expression/test_expression.py (100%) rename {src/tests => tests}/libecalc/expression/test_expression_evaluator.py (100%) rename {src/tests => tests}/libecalc/input/mappers/test_consumer_chart.py (100%) rename {src/tests => tests}/libecalc/input/mappers/test_energy_usage_model.py (100%) rename {src/tests => tests}/libecalc/input/mappers/test_facility_input.py (100%) rename {src/tests => tests}/libecalc/input/mappers/test_model_mapper.py (100%) rename {src/tests => tests}/libecalc/input/mappers/test_resolve_fuel.py (100%) rename {src/tests => tests}/libecalc/input/mappers/test_utils.py (100%) rename {src/tests => tests}/libecalc/input/mappers/variables_mapper/test_timeseries.py (100%) rename {src/tests => tests}/libecalc/input/mappers/variables_mapper/test_timeseries_utils.py (100%) rename {src/tests => tests}/libecalc/input/mappers/variables_mapper/test_variables_mapper.py (100%) rename {src/tests => tests}/libecalc/input/test_create_references.py (100%) rename {src/tests => tests}/libecalc/input/test_file_io.py (100%) rename {src/tests => tests}/libecalc/input/test_validation_errors.py (100%) rename {src/tests => tests}/libecalc/input/test_yaml_configuration.py (100%) rename {src/tests => tests}/libecalc/input/yaml_types/system/test_system_component_conditions.py (100%) rename {src/tests => tests}/libecalc/input/yaml_types/test_yaml_variable.py (100%) rename {src/tests => tests}/libecalc/integration/snapshots/test_all_consumer_with_time_slots_models/test_all_consumer_with_time_slots_models_results/all_consumer_with_time_slots_models_v3.json (100%) rename {src/tests => tests}/libecalc/integration/snapshots/test_all_energy_usage_models/test_all_results/all_energy_usage_models_v3.json (100%) rename {src/tests => tests}/libecalc/integration/snapshots/test_consumer_system_v2/test_compressor_system_v2_results/consumer_system_v2-consumer_system_v2_yaml/consumer_system_v2.json (100%) rename {src/tests => tests}/libecalc/integration/test_all_consumer_with_time_slots_models.py (100%) rename {src/tests => tests}/libecalc/integration/test_all_energy_usage_models.py (100%) rename {src/tests => tests}/libecalc/integration/test_consumer_system_v2.py (100%) rename {src/tests => tests}/libecalc/integration/test_minimal_is_valid.py (100%) rename {src/tests => tests}/libecalc/integration/test_multiple_installations.py (100%) rename {src/tests => tests}/libecalc/output/flow_diagram/conftest.py (100%) rename {src/tests => tests}/libecalc/output/flow_diagram/snapshots/test_ecalc_model_mapper/test_all_energy_usage_models/all_energy_usage_models_fde.json (100%) rename {src/tests => tests}/libecalc/output/flow_diagram/snapshots/test_ecalc_model_mapper/test_case_with_dates/actual_fde.json (100%) rename {src/tests => tests}/libecalc/output/flow_diagram/test_ecalc_model_mapper.py (100%) rename {src/tests => tests}/libecalc/output/test_frequencies.py (100%) rename {src/tests => tests}/libecalc/presentation/exporter/formatters/test_csv_formatter.py (100%) rename {src/tests => tests}/libecalc/presentation/exporter/handlers/test_handlers.py (100%) rename {src/tests => tests}/libecalc/presentation/exporter/test_ltp.py (100%) rename {src/tests => tests}/libecalc/presentation/json_result/test_aggregators.py (100%) rename {src/tests => tests}/libecalc/presentation/simple_result/test_simple.py (100%) rename {src/tests => tests}/libecalc/presentation/yaml/test_location.py (100%) rename {src/tests => tests}/libecalc/presentation/yaml/test_venting_emitter.py (100%) rename {src/tests => tests}/libecalc/presentation/yaml/test_venting_emitter_validation_errors.py (100%) rename {src/tests => tests}/libecalc/presentation/yaml/test_yaml_model.py (100%) rename {src/tests => tests}/libecalc/presentation/yaml/yaml_models/test_yaml_model_errors.py (100%) rename {src/tests => tests}/libecalc/presentation/yaml/yaml_types/models/conftest.py (77%) rename {src/tests => tests}/libecalc/presentation/yaml/yaml_types/models/test_model_reference_validation.py (100%) rename {src/tests => tests}/libecalc/presentation/yaml/yaml_types/models/test_yaml_simplified_compressor_train.py (92%) rename {src/tests => tests}/libecalc/presentation/yaml/yaml_types/models/test_yaml_single_speed_compressor_train.py (92%) rename {src/tests => tests}/libecalc/presentation/yaml/yaml_types/models/test_yaml_variable_speed_compressor_train.py (92%) rename {src/tests => tests}/libecalc/presentation/yaml/yaml_types/test_categories.py (100%) rename {src/tests => tests}/libecalc/presentation/yaml/yaml_types/test_missing_files.py (100%) diff --git a/pyproject.toml b/pyproject.toml index c5d29dd2de..5e644d8a80 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -74,6 +74,10 @@ build-backend = "poetry.core.masonry.api" # plugins, plugin config etc [tool.pytest.ini_options] +testpaths = [ + "tests", +] +addopts = "--import-mode=importlib" filterwarnings = [ "error::DeprecationWarning", # Treat all DeprecationWarnings as errors and ignore explicitly below if needed "ignore:Avoid using the dto.*:DeprecationWarning", # Ignore internal deprecation warnings diff --git a/src/tests/ecalc_cli/test_cache.py b/src/libecalc/testing/__init__.py similarity index 100% rename from src/tests/ecalc_cli/test_cache.py rename to src/libecalc/testing/__init__.py diff --git a/src/tests/libecalc/yaml_builder.py b/src/libecalc/testing/yaml_builder.py similarity index 75% rename from src/tests/libecalc/yaml_builder.py rename to src/libecalc/testing/yaml_builder.py index 91ab93471f..d58deed36e 100644 --- a/src/tests/libecalc/yaml_builder.py +++ b/src/libecalc/testing/yaml_builder.py @@ -1,9 +1,7 @@ import abc from enum import Enum -from inspect import isclass -from typing import List, Self, TypeVar, Generic, Any, get_origin, get_args, Type, cast +from typing import List, Self, TypeVar, Generic, get_args, cast -from pydantic import TypeAdapter, BaseModel from typing_extensions import get_original_bases from libecalc.dto.types import ConsumerUserDefinedCategoryType @@ -35,7 +33,7 @@ class Builder(abc.ABC, Generic[T]): - __model__: type[YamlBase] + __model__: type[T] def __init_subclass__(cls, **kwargs): # When this class is subclassed we parse the type to be able to use the pydantic model for build and validate @@ -46,11 +44,9 @@ def __init_subclass__(cls, **kwargs): original_base = original_bases[0] # Get the type of T in Builder[T], assuming a single class, i.e. no unions - model_type = [arg for arg in get_args(original_base)][0] + model_type: type[T] = [arg for arg in get_args(original_base)][0] - # Type should be a YamlBase - assert isinstance(model_type, type(YamlBase)) - cls.__model__ = cast(type(YamlBase), model_type) + cls.__model__ = model_type @classmethod def get_model_fields(cls) -> list[str]: @@ -115,32 +111,6 @@ def with_consumption_rate_type(self, consumption_rate_type: ConsumptionRateType) TYamlClass = TypeVar("TYamlClass", bound=YamlBase) -class YamlModelContainer(Generic[TYamlClass]): - """ - Consumer, Installation wrapper that can be used to bundle the component with its dependencies. - - A fuel consumer that uses a model reference can then use this class to keep the referenced model in a single class. - """ - - def __init__(self, component: TYamlClass): - self.component = component - self.models = None - self.time_series = None - self.facility_inputs = None - - def with_models(self, models) -> Self: - self.models = models - return self - - def with_time_series(self, time_series): - self.time_series = time_series - return self - - def with_facility_inputs(self, facility_inputs) -> Self: - self.facility_inputs = facility_inputs - return self - - class YamlFuelConsumerBuilder(Builder[YamlFuelConsumer]): def __init__(self): self.name = None @@ -192,42 +162,24 @@ def with_name(self, name: str) -> Self: self.name = name return self - def with_fuel_consumers( - self, fuel_consumers: list[YamlFuelConsumer | YamlModelContainer[YamlFuelConsumer]] - ) -> Self: + def with_fuel_consumers(self, fuel_consumers: list[YamlFuelConsumer]) -> Self: new_fuel_consumers = [] for fuel_consumer in fuel_consumers: - if isinstance(fuel_consumer, YamlModelContainer): - self._yaml_model_containers.append(fuel_consumer) - new_fuel_consumers.append(fuel_consumer.component) - else: - new_fuel_consumers.append(fuel_consumer) + new_fuel_consumers.append(fuel_consumer) self.fuel_consumers = new_fuel_consumers return self - def with_venting_emitters( - self, venting_emitters: list[YamlVentingEmitter | YamlModelContainer[YamlVentingEmitter]] - ) -> Self: + def with_venting_emitters(self, venting_emitters: list[YamlVentingEmitter]) -> Self: new_venting_emitters = [] for venting_emitter in venting_emitters: - if isinstance(venting_emitter, YamlModelContainer): - self._yaml_model_containers.append(venting_emitter) - new_venting_emitters.append(venting_emitter.component) - else: - new_venting_emitters.append(venting_emitter) + new_venting_emitters.append(venting_emitter) self.venting_emitters = new_venting_emitters return self - def with_generator_sets( - self, generator_sets: list[YamlGeneratorSet | YamlModelContainer[YamlGeneratorSet]] - ) -> Self: + def with_generator_sets(self, generator_sets: list[YamlGeneratorSet]) -> Self: new_generator_sets = [] for generator_set in generator_sets: - if isinstance(generator_set, YamlModelContainer): - self._yaml_model_containers.append(generator_set) - new_generator_sets.append(generator_set.component) - else: - new_generator_sets.append(generator_set) + new_generator_sets.append(generator_set) self.generator_sets = new_generator_sets return self @@ -313,20 +265,14 @@ def with_variables(self, variables: YamlVariables): self.variables = variables return self - def with_installations(self, installations: List[YamlInstallation | YamlModelContainer[YamlInstallation]]): + def with_installations(self, installations: List[YamlInstallation]): if len(installations) == 0: self.installations = [] return self new_installations = [] for installation in installations: - if isinstance(installation, YamlModelContainer): - self.models.extend(installation.models) - self.facility_inputs.extend(installation.facility_inputs) - self.time_series.extend(installation.time_series) - new_installations.append(installation.component) - else: - new_installations.append(installation) + new_installations.append(installation) self.installations = new_installations return self diff --git a/src/tests/conftest.py b/tests/conftest.py similarity index 99% rename from src/tests/conftest.py rename to tests/conftest.py index 9ee919c5f7..989185c52d 100644 --- a/src/tests/conftest.py +++ b/tests/conftest.py @@ -21,7 +21,7 @@ from libecalc.presentation.yaml.yaml_entities import MemoryResource, ResourceStream from libecalc.presentation.yaml.yaml_models.yaml_model import ReaderType, YamlConfiguration, YamlValidator from libecalc.presentation.yaml.yaml_types.components.yaml_asset import YamlAsset -from tests.libecalc.yaml_builder import ( +from libecalc.testing.yaml_builder import ( YamlAssetBuilder, YamlEnergyUsageModelDirectBuilder, YamlFuelConsumerBuilder, diff --git a/src/tests/ecalc_cli/conftest.py b/tests/ecalc_cli/conftest.py similarity index 100% rename from src/tests/ecalc_cli/conftest.py rename to tests/ecalc_cli/conftest.py diff --git a/src/tests/ecalc_cli/snapshots/test_app/test_component_name_csv/waterinj.csv b/tests/ecalc_cli/snapshots/test_app/test_component_name_csv/waterinj.csv similarity index 100% rename from src/tests/ecalc_cli/snapshots/test_app/test_component_name_csv/waterinj.csv rename to tests/ecalc_cli/snapshots/test_app/test_component_name_csv/waterinj.csv diff --git a/src/tests/ecalc_cli/snapshots/test_app/test_component_name_json/waterinj.json b/tests/ecalc_cli/snapshots/test_app/test_component_name_json/waterinj.json similarity index 100% rename from src/tests/ecalc_cli/snapshots/test_app/test_component_name_json/waterinj.json rename to tests/ecalc_cli/snapshots/test_app/test_component_name_json/waterinj.json diff --git a/src/tests/ecalc_cli/snapshots/test_app/test_component_name_json_stdout/waterinj.json b/tests/ecalc_cli/snapshots/test_app/test_component_name_json_stdout/waterinj.json similarity index 100% rename from src/tests/ecalc_cli/snapshots/test_app/test_component_name_json_stdout/waterinj.json rename to tests/ecalc_cli/snapshots/test_app/test_component_name_json_stdout/waterinj.json diff --git a/src/tests/ecalc_cli/snapshots/test_app/test_csv_default/test.csv b/tests/ecalc_cli/snapshots/test_app/test_csv_default/test.csv similarity index 100% rename from src/tests/ecalc_cli/snapshots/test_app/test_csv_default/test.csv rename to tests/ecalc_cli/snapshots/test_app/test_csv_default/test.csv diff --git a/src/tests/ecalc_cli/snapshots/test_app/test_csv_resampled/results_resampled.csv b/tests/ecalc_cli/snapshots/test_app/test_csv_resampled/results_resampled.csv similarity index 100% rename from src/tests/ecalc_cli/snapshots/test_app/test_csv_resampled/results_resampled.csv rename to tests/ecalc_cli/snapshots/test_app/test_csv_resampled/results_resampled.csv diff --git a/src/tests/ecalc_cli/snapshots/test_app/test_csv_temporal_default/test.csv b/tests/ecalc_cli/snapshots/test_app/test_csv_temporal_default/test.csv similarity index 100% rename from src/tests/ecalc_cli/snapshots/test_app/test_csv_temporal_default/test.csv rename to tests/ecalc_cli/snapshots/test_app/test_csv_temporal_default/test.csv diff --git a/src/tests/ecalc_cli/snapshots/test_app/test_csv_temporal_default/test_temporal.csv b/tests/ecalc_cli/snapshots/test_app/test_csv_temporal_default/test_temporal.csv similarity index 100% rename from src/tests/ecalc_cli/snapshots/test_app/test_csv_temporal_default/test_temporal.csv rename to tests/ecalc_cli/snapshots/test_app/test_csv_temporal_default/test_temporal.csv diff --git a/src/tests/ecalc_cli/snapshots/test_app/test_full_csv/results.csv b/tests/ecalc_cli/snapshots/test_app/test_full_csv/results.csv similarity index 100% rename from src/tests/ecalc_cli/snapshots/test_app/test_full_csv/results.csv rename to tests/ecalc_cli/snapshots/test_app/test_full_csv/results.csv diff --git a/src/tests/ecalc_cli/snapshots/test_app/test_full_simplified_json/results.json b/tests/ecalc_cli/snapshots/test_app/test_full_simplified_json/results.json similarity index 100% rename from src/tests/ecalc_cli/snapshots/test_app/test_full_simplified_json/results.json rename to tests/ecalc_cli/snapshots/test_app/test_full_simplified_json/results.json diff --git a/src/tests/ecalc_cli/snapshots/test_app/test_json_advanced_model/test_json_advanced_model_v3.json b/tests/ecalc_cli/snapshots/test_app/test_json_advanced_model/test_json_advanced_model_v3.json similarity index 100% rename from src/tests/ecalc_cli/snapshots/test_app/test_json_advanced_model/test_json_advanced_model_v3.json rename to tests/ecalc_cli/snapshots/test_app/test_json_advanced_model/test_json_advanced_model_v3.json diff --git a/src/tests/ecalc_cli/snapshots/test_app/test_json_resampled/results_resampled.json b/tests/ecalc_cli/snapshots/test_app/test_json_resampled/results_resampled.json similarity index 100% rename from src/tests/ecalc_cli/snapshots/test_app/test_json_resampled/results_resampled.json rename to tests/ecalc_cli/snapshots/test_app/test_json_resampled/results_resampled.json diff --git a/src/tests/ecalc_cli/snapshots/test_app/test_json_true/test_v3.json b/tests/ecalc_cli/snapshots/test_app/test_json_true/test_v3.json similarity index 100% rename from src/tests/ecalc_cli/snapshots/test_app/test_json_true/test_v3.json rename to tests/ecalc_cli/snapshots/test_app/test_json_true/test_v3.json diff --git a/src/tests/ecalc_cli/snapshots/test_app/test_json_true_detailed_output/test_full_json_v3.json b/tests/ecalc_cli/snapshots/test_app/test_json_true_detailed_output/test_full_json_v3.json similarity index 100% rename from src/tests/ecalc_cli/snapshots/test_app/test_json_true_detailed_output/test_full_json_v3.json rename to tests/ecalc_cli/snapshots/test_app/test_json_true_detailed_output/test_full_json_v3.json diff --git a/src/tests/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.INST_A.ltp.tsv b/tests/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.INST_A.ltp.tsv similarity index 100% rename from src/tests/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.INST_A.ltp.tsv rename to tests/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.INST_A.ltp.tsv diff --git a/src/tests/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.INST_A.ltp.tsv.json b/tests/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.INST_A.ltp.tsv.json similarity index 100% rename from src/tests/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.INST_A.ltp.tsv.json rename to tests/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.INST_A.ltp.tsv.json diff --git a/src/tests/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.MOBILE_HOST_FIELD.ltp.tsv b/tests/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.MOBILE_HOST_FIELD.ltp.tsv similarity index 100% rename from src/tests/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.MOBILE_HOST_FIELD.ltp.tsv rename to tests/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.MOBILE_HOST_FIELD.ltp.tsv diff --git a/src/tests/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.MOBILE_HOST_FIELD.ltp.tsv.json b/tests/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.MOBILE_HOST_FIELD.ltp.tsv.json similarity index 100% rename from src/tests/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.MOBILE_HOST_FIELD.ltp.tsv.json rename to tests/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.MOBILE_HOST_FIELD.ltp.tsv.json diff --git a/src/tests/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.MOBILE_SATELLITE_A.ltp.tsv b/tests/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.MOBILE_SATELLITE_A.ltp.tsv similarity index 100% rename from src/tests/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.MOBILE_SATELLITE_A.ltp.tsv rename to tests/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.MOBILE_SATELLITE_A.ltp.tsv diff --git a/src/tests/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.MOBILE_SATELLITE_A.ltp.tsv.json b/tests/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.MOBILE_SATELLITE_A.ltp.tsv.json similarity index 100% rename from src/tests/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.MOBILE_SATELLITE_A.ltp.tsv.json rename to tests/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.MOBILE_SATELLITE_A.ltp.tsv.json diff --git a/src/tests/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.MOBILE_SATELLITE_B.ltp.tsv b/tests/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.MOBILE_SATELLITE_B.ltp.tsv similarity index 100% rename from src/tests/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.MOBILE_SATELLITE_B.ltp.tsv rename to tests/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.MOBILE_SATELLITE_B.ltp.tsv diff --git a/src/tests/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.MOBILE_SATELLITE_B.ltp.tsv.json b/tests/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.MOBILE_SATELLITE_B.ltp.tsv.json similarity index 100% rename from src/tests/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.MOBILE_SATELLITE_B.ltp.tsv.json rename to tests/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.MOBILE_SATELLITE_B.ltp.tsv.json diff --git a/src/tests/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.POWER_FROM_SHORE_EVENT.ltp.tsv b/tests/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.POWER_FROM_SHORE_EVENT.ltp.tsv similarity index 100% rename from src/tests/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.POWER_FROM_SHORE_EVENT.ltp.tsv rename to tests/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.POWER_FROM_SHORE_EVENT.ltp.tsv diff --git a/src/tests/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.POWER_FROM_SHORE_EVENT.ltp.tsv.json b/tests/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.POWER_FROM_SHORE_EVENT.ltp.tsv.json similarity index 100% rename from src/tests/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.POWER_FROM_SHORE_EVENT.ltp.tsv.json rename to tests/ecalc_cli/snapshots/test_app/test_new_ltp_export_properly/test.POWER_FROM_SHORE_EVENT.ltp.tsv.json diff --git a/src/tests/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.INST_A.stp.tsv b/tests/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.INST_A.stp.tsv similarity index 100% rename from src/tests/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.INST_A.stp.tsv rename to tests/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.INST_A.stp.tsv diff --git a/src/tests/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.INST_A.stp.tsv.json b/tests/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.INST_A.stp.tsv.json similarity index 100% rename from src/tests/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.INST_A.stp.tsv.json rename to tests/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.INST_A.stp.tsv.json diff --git a/src/tests/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.MOBILE_HOST_FIELD.stp.tsv b/tests/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.MOBILE_HOST_FIELD.stp.tsv similarity index 100% rename from src/tests/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.MOBILE_HOST_FIELD.stp.tsv rename to tests/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.MOBILE_HOST_FIELD.stp.tsv diff --git a/src/tests/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.MOBILE_HOST_FIELD.stp.tsv.json b/tests/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.MOBILE_HOST_FIELD.stp.tsv.json similarity index 100% rename from src/tests/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.MOBILE_HOST_FIELD.stp.tsv.json rename to tests/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.MOBILE_HOST_FIELD.stp.tsv.json diff --git a/src/tests/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.MOBILE_SATELLITE_A.stp.tsv b/tests/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.MOBILE_SATELLITE_A.stp.tsv similarity index 100% rename from src/tests/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.MOBILE_SATELLITE_A.stp.tsv rename to tests/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.MOBILE_SATELLITE_A.stp.tsv diff --git a/src/tests/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.MOBILE_SATELLITE_A.stp.tsv.json b/tests/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.MOBILE_SATELLITE_A.stp.tsv.json similarity index 100% rename from src/tests/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.MOBILE_SATELLITE_A.stp.tsv.json rename to tests/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.MOBILE_SATELLITE_A.stp.tsv.json diff --git a/src/tests/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.MOBILE_SATELLITE_B.stp.tsv b/tests/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.MOBILE_SATELLITE_B.stp.tsv similarity index 100% rename from src/tests/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.MOBILE_SATELLITE_B.stp.tsv rename to tests/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.MOBILE_SATELLITE_B.stp.tsv diff --git a/src/tests/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.MOBILE_SATELLITE_B.stp.tsv.json b/tests/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.MOBILE_SATELLITE_B.stp.tsv.json similarity index 100% rename from src/tests/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.MOBILE_SATELLITE_B.stp.tsv.json rename to tests/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.MOBILE_SATELLITE_B.stp.tsv.json diff --git a/src/tests/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.POWER_FROM_SHORE_EVENT.stp.tsv b/tests/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.POWER_FROM_SHORE_EVENT.stp.tsv similarity index 100% rename from src/tests/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.POWER_FROM_SHORE_EVENT.stp.tsv rename to tests/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.POWER_FROM_SHORE_EVENT.stp.tsv diff --git a/src/tests/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.POWER_FROM_SHORE_EVENT.stp.tsv.json b/tests/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.POWER_FROM_SHORE_EVENT.stp.tsv.json similarity index 100% rename from src/tests/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.POWER_FROM_SHORE_EVENT.stp.tsv.json rename to tests/ecalc_cli/snapshots/test_app/test_new_stp_export_properly/test.POWER_FROM_SHORE_EVENT.stp.tsv.json diff --git a/src/tests/ecalc_cli/snapshots/test_app/test_valid/flow-diagram.json b/tests/ecalc_cli/snapshots/test_app/test_valid/flow-diagram.json similarity index 100% rename from src/tests/ecalc_cli/snapshots/test_app/test_valid/flow-diagram.json rename to tests/ecalc_cli/snapshots/test_app/test_valid/flow-diagram.json diff --git a/src/tests/ecalc_cli/test_app.py b/tests/ecalc_cli/test_app.py similarity index 100% rename from src/tests/ecalc_cli/test_app.py rename to tests/ecalc_cli/test_app.py diff --git a/src/tests/libecalc/common/utils/test_compute_emission_intensity_yearly.py b/tests/ecalc_cli/test_cache.py similarity index 100% rename from src/tests/libecalc/common/utils/test_compute_emission_intensity_yearly.py rename to tests/ecalc_cli/test_cache.py diff --git a/src/tests/ecalc_neqsim_wrapper/conftest.py b/tests/ecalc_neqsim_wrapper/conftest.py similarity index 100% rename from src/tests/ecalc_neqsim_wrapper/conftest.py rename to tests/ecalc_neqsim_wrapper/conftest.py diff --git a/src/tests/ecalc_neqsim_wrapper/integration_tests/test_gerg_fluid.py b/tests/ecalc_neqsim_wrapper/integration_tests/test_gerg_fluid.py similarity index 100% rename from src/tests/ecalc_neqsim_wrapper/integration_tests/test_gerg_fluid.py rename to tests/ecalc_neqsim_wrapper/integration_tests/test_gerg_fluid.py diff --git a/src/tests/ecalc_neqsim_wrapper/integration_tests/test_remove_liquid.py b/tests/ecalc_neqsim_wrapper/integration_tests/test_remove_liquid.py similarity index 100% rename from src/tests/ecalc_neqsim_wrapper/integration_tests/test_remove_liquid.py rename to tests/ecalc_neqsim_wrapper/integration_tests/test_remove_liquid.py diff --git a/src/tests/ecalc_neqsim_wrapper/unit_tests/test_java_service.py b/tests/ecalc_neqsim_wrapper/unit_tests/test_java_service.py similarity index 100% rename from src/tests/ecalc_neqsim_wrapper/unit_tests/test_java_service.py rename to tests/ecalc_neqsim_wrapper/unit_tests/test_java_service.py diff --git a/src/tests/ecalc_neqsim_wrapper/unit_tests/test_neqsim_fluid.py b/tests/ecalc_neqsim_wrapper/unit_tests/test_neqsim_fluid.py similarity index 100% rename from src/tests/ecalc_neqsim_wrapper/unit_tests/test_neqsim_fluid.py rename to tests/ecalc_neqsim_wrapper/unit_tests/test_neqsim_fluid.py diff --git a/src/tests/libecalc/common/test_constants.py b/tests/libecalc/common/test_constants.py similarity index 100% rename from src/tests/libecalc/common/test_constants.py rename to tests/libecalc/common/test_constants.py diff --git a/src/tests/libecalc/common/test_dangerous.py b/tests/libecalc/common/test_dangerous.py similarity index 100% rename from src/tests/libecalc/common/test_dangerous.py rename to tests/libecalc/common/test_dangerous.py diff --git a/src/tests/libecalc/common/test_graph.py b/tests/libecalc/common/test_graph.py similarity index 100% rename from src/tests/libecalc/common/test_graph.py rename to tests/libecalc/common/test_graph.py diff --git a/src/tests/libecalc/common/test_list_utils.py b/tests/libecalc/common/test_list_utils.py similarity index 100% rename from src/tests/libecalc/common/test_list_utils.py rename to tests/libecalc/common/test_list_utils.py diff --git a/src/tests/libecalc/common/test_numbers.py b/tests/libecalc/common/test_numbers.py similarity index 100% rename from src/tests/libecalc/common/test_numbers.py rename to tests/libecalc/common/test_numbers.py diff --git a/src/tests/libecalc/common/test_string_utils.py b/tests/libecalc/common/test_string_utils.py similarity index 100% rename from src/tests/libecalc/common/test_string_utils.py rename to tests/libecalc/common/test_string_utils.py diff --git a/src/tests/libecalc/common/test_tabular_time_series.py b/tests/libecalc/common/test_tabular_time_series.py similarity index 100% rename from src/tests/libecalc/common/test_tabular_time_series.py rename to tests/libecalc/common/test_tabular_time_series.py diff --git a/src/tests/libecalc/common/test_temporal_model.py b/tests/libecalc/common/test_temporal_model.py similarity index 100% rename from src/tests/libecalc/common/test_temporal_model.py rename to tests/libecalc/common/test_temporal_model.py diff --git a/src/tests/libecalc/common/test_time_utils.py b/tests/libecalc/common/test_time_utils.py similarity index 100% rename from src/tests/libecalc/common/test_time_utils.py rename to tests/libecalc/common/test_time_utils.py diff --git a/src/tests/libecalc/common/test_unit.py b/tests/libecalc/common/test_unit.py similarity index 100% rename from src/tests/libecalc/common/test_unit.py rename to tests/libecalc/common/test_unit.py diff --git a/src/tests/libecalc/common/test_version.py b/tests/libecalc/common/test_version.py similarity index 100% rename from src/tests/libecalc/common/test_version.py rename to tests/libecalc/common/test_version.py diff --git a/src/tests/libecalc/common/utils/test_adjustment.py b/tests/libecalc/common/utils/test_adjustment.py similarity index 100% rename from src/tests/libecalc/common/utils/test_adjustment.py rename to tests/libecalc/common/utils/test_adjustment.py diff --git a/tests/libecalc/common/utils/test_compute_emission_intensity_yearly.py b/tests/libecalc/common/utils/test_compute_emission_intensity_yearly.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/tests/libecalc/common/utils/test_math_utils.py b/tests/libecalc/common/utils/test_math_utils.py similarity index 100% rename from src/tests/libecalc/common/utils/test_math_utils.py rename to tests/libecalc/common/utils/test_math_utils.py diff --git a/src/tests/libecalc/common/utils/test_rates.py b/tests/libecalc/common/utils/test_rates.py similarity index 100% rename from src/tests/libecalc/common/utils/test_rates.py rename to tests/libecalc/common/utils/test_rates.py diff --git a/src/tests/libecalc/core/conftest.py b/tests/libecalc/core/conftest.py similarity index 100% rename from src/tests/libecalc/core/conftest.py rename to tests/libecalc/core/conftest.py diff --git a/src/tests/libecalc/core/consumers/conftest.py b/tests/libecalc/core/consumers/conftest.py similarity index 100% rename from src/tests/libecalc/core/consumers/conftest.py rename to tests/libecalc/core/consumers/conftest.py diff --git a/src/tests/libecalc/core/consumers/consumer_function/test_consumer_function.py b/tests/libecalc/core/consumers/consumer_function/test_consumer_function.py similarity index 100% rename from src/tests/libecalc/core/consumers/consumer_function/test_consumer_function.py rename to tests/libecalc/core/consumers/consumer_function/test_consumer_function.py diff --git a/src/tests/libecalc/core/consumers/consumer_function/test_direct_expression_consumer_function.py b/tests/libecalc/core/consumers/consumer_function/test_direct_expression_consumer_function.py similarity index 100% rename from src/tests/libecalc/core/consumers/consumer_function/test_direct_expression_consumer_function.py rename to tests/libecalc/core/consumers/consumer_function/test_direct_expression_consumer_function.py diff --git a/src/tests/libecalc/core/consumers/system/conftest.py b/tests/libecalc/core/consumers/system/conftest.py similarity index 100% rename from src/tests/libecalc/core/consumers/system/conftest.py rename to tests/libecalc/core/consumers/system/conftest.py diff --git a/src/tests/libecalc/core/consumers/system/test_consumer_system.py b/tests/libecalc/core/consumers/system/test_consumer_system.py similarity index 100% rename from src/tests/libecalc/core/consumers/system/test_consumer_system.py rename to tests/libecalc/core/consumers/system/test_consumer_system.py diff --git a/src/tests/libecalc/core/consumers/system/test_operational_setting.py b/tests/libecalc/core/consumers/system/test_operational_setting.py similarity index 100% rename from src/tests/libecalc/core/consumers/system/test_operational_setting.py rename to tests/libecalc/core/consumers/system/test_operational_setting.py diff --git a/src/tests/libecalc/core/consumers/system/test_system_results.py b/tests/libecalc/core/consumers/system/test_system_results.py similarity index 100% rename from src/tests/libecalc/core/consumers/system/test_system_results.py rename to tests/libecalc/core/consumers/system/test_system_results.py diff --git a/src/tests/libecalc/core/consumers/system/test_system_utils.py b/tests/libecalc/core/consumers/system/test_system_utils.py similarity index 100% rename from src/tests/libecalc/core/consumers/system/test_system_utils.py rename to tests/libecalc/core/consumers/system/test_system_utils.py diff --git a/src/tests/libecalc/core/consumers/test_consumer_utils.py b/tests/libecalc/core/consumers/test_consumer_utils.py similarity index 100% rename from src/tests/libecalc/core/consumers/test_consumer_utils.py rename to tests/libecalc/core/consumers/test_consumer_utils.py diff --git a/src/tests/libecalc/core/consumers/test_crossover.py b/tests/libecalc/core/consumers/test_crossover.py similarity index 100% rename from src/tests/libecalc/core/consumers/test_crossover.py rename to tests/libecalc/core/consumers/test_crossover.py diff --git a/src/tests/libecalc/core/consumers/test_genset.py b/tests/libecalc/core/consumers/test_genset.py similarity index 100% rename from src/tests/libecalc/core/consumers/test_genset.py rename to tests/libecalc/core/consumers/test_genset.py diff --git a/src/tests/libecalc/core/consumers/test_legacy_consumer.py b/tests/libecalc/core/consumers/test_legacy_consumer.py similarity index 100% rename from src/tests/libecalc/core/consumers/test_legacy_consumer.py rename to tests/libecalc/core/consumers/test_legacy_consumer.py diff --git a/src/tests/libecalc/core/models/chart/test_chart_curve.py b/tests/libecalc/core/models/chart/test_chart_curve.py similarity index 100% rename from src/tests/libecalc/core/models/chart/test_chart_curve.py rename to tests/libecalc/core/models/chart/test_chart_curve.py diff --git a/src/tests/libecalc/core/models/chart/test_single_speed_chart.py b/tests/libecalc/core/models/chart/test_single_speed_chart.py similarity index 100% rename from src/tests/libecalc/core/models/chart/test_single_speed_chart.py rename to tests/libecalc/core/models/chart/test_single_speed_chart.py diff --git a/src/tests/libecalc/core/models/chart/test_variable_speed_chart.py b/tests/libecalc/core/models/chart/test_variable_speed_chart.py similarity index 100% rename from src/tests/libecalc/core/models/chart/test_variable_speed_chart.py rename to tests/libecalc/core/models/chart/test_variable_speed_chart.py diff --git a/src/tests/libecalc/core/models/compressor_modelling/conftest.py b/tests/libecalc/core/models/compressor_modelling/conftest.py similarity index 100% rename from src/tests/libecalc/core/models/compressor_modelling/conftest.py rename to tests/libecalc/core/models/compressor_modelling/conftest.py diff --git a/src/tests/libecalc/core/models/compressor_modelling/sampled/input/compressor_sampled_3d_testdata3.csv b/tests/libecalc/core/models/compressor_modelling/sampled/input/compressor_sampled_3d_testdata3.csv similarity index 100% rename from src/tests/libecalc/core/models/compressor_modelling/sampled/input/compressor_sampled_3d_testdata3.csv rename to tests/libecalc/core/models/compressor_modelling/sampled/input/compressor_sampled_3d_testdata3.csv diff --git a/src/tests/libecalc/core/models/compressor_modelling/sampled/input/compressor_sampled_3d_vsd_testdata.csv b/tests/libecalc/core/models/compressor_modelling/sampled/input/compressor_sampled_3d_vsd_testdata.csv similarity index 100% rename from src/tests/libecalc/core/models/compressor_modelling/sampled/input/compressor_sampled_3d_vsd_testdata.csv rename to tests/libecalc/core/models/compressor_modelling/sampled/input/compressor_sampled_3d_vsd_testdata.csv diff --git a/src/tests/libecalc/core/models/compressor_modelling/sampled/input/compressor_sampled_3d_vsd_testdata2.csv b/tests/libecalc/core/models/compressor_modelling/sampled/input/compressor_sampled_3d_vsd_testdata2.csv similarity index 100% rename from src/tests/libecalc/core/models/compressor_modelling/sampled/input/compressor_sampled_3d_vsd_testdata2.csv rename to tests/libecalc/core/models/compressor_modelling/sampled/input/compressor_sampled_3d_vsd_testdata2.csv diff --git a/src/tests/libecalc/core/models/compressor_modelling/sampled/test_compressor_sampled.py b/tests/libecalc/core/models/compressor_modelling/sampled/test_compressor_sampled.py similarity index 100% rename from src/tests/libecalc/core/models/compressor_modelling/sampled/test_compressor_sampled.py rename to tests/libecalc/core/models/compressor_modelling/sampled/test_compressor_sampled.py diff --git a/src/tests/libecalc/core/models/compressor_modelling/sampled/test_compressor_sampled_1d.py b/tests/libecalc/core/models/compressor_modelling/sampled/test_compressor_sampled_1d.py similarity index 100% rename from src/tests/libecalc/core/models/compressor_modelling/sampled/test_compressor_sampled_1d.py rename to tests/libecalc/core/models/compressor_modelling/sampled/test_compressor_sampled_1d.py diff --git a/src/tests/libecalc/core/models/compressor_modelling/sampled/test_compressor_sampled_2d.py b/tests/libecalc/core/models/compressor_modelling/sampled/test_compressor_sampled_2d.py similarity index 100% rename from src/tests/libecalc/core/models/compressor_modelling/sampled/test_compressor_sampled_2d.py rename to tests/libecalc/core/models/compressor_modelling/sampled/test_compressor_sampled_2d.py diff --git a/src/tests/libecalc/core/models/compressor_modelling/sampled/test_compressor_sampled_3d.py b/tests/libecalc/core/models/compressor_modelling/sampled/test_compressor_sampled_3d.py similarity index 100% rename from src/tests/libecalc/core/models/compressor_modelling/sampled/test_compressor_sampled_3d.py rename to tests/libecalc/core/models/compressor_modelling/sampled/test_compressor_sampled_3d.py diff --git a/src/tests/libecalc/core/models/compressor_modelling/sampled/test_convex_hull_common.py b/tests/libecalc/core/models/compressor_modelling/sampled/test_convex_hull_common.py similarity index 100% rename from src/tests/libecalc/core/models/compressor_modelling/sampled/test_convex_hull_common.py rename to tests/libecalc/core/models/compressor_modelling/sampled/test_convex_hull_common.py diff --git a/src/tests/libecalc/core/models/compressor_modelling/test_compressor_chart.py b/tests/libecalc/core/models/compressor_modelling/test_compressor_chart.py similarity index 100% rename from src/tests/libecalc/core/models/compressor_modelling/test_compressor_chart.py rename to tests/libecalc/core/models/compressor_modelling/test_compressor_chart.py diff --git a/src/tests/libecalc/core/models/compressor_modelling/test_compressor_chart_generator.py b/tests/libecalc/core/models/compressor_modelling/test_compressor_chart_generator.py similarity index 100% rename from src/tests/libecalc/core/models/compressor_modelling/test_compressor_chart_generator.py rename to tests/libecalc/core/models/compressor_modelling/test_compressor_chart_generator.py diff --git a/src/tests/libecalc/core/models/compressor_modelling/test_compressor_model_vs_unisim.py b/tests/libecalc/core/models/compressor_modelling/test_compressor_model_vs_unisim.py similarity index 100% rename from src/tests/libecalc/core/models/compressor_modelling/test_compressor_model_vs_unisim.py rename to tests/libecalc/core/models/compressor_modelling/test_compressor_model_vs_unisim.py diff --git a/src/tests/libecalc/core/models/compressor_modelling/test_compressor_train_base.py b/tests/libecalc/core/models/compressor_modelling/test_compressor_train_base.py similarity index 100% rename from src/tests/libecalc/core/models/compressor_modelling/test_compressor_train_base.py rename to tests/libecalc/core/models/compressor_modelling/test_compressor_train_base.py diff --git a/src/tests/libecalc/core/models/compressor_modelling/test_compressor_train_common_shaft_utils.py b/tests/libecalc/core/models/compressor_modelling/test_compressor_train_common_shaft_utils.py similarity index 100% rename from src/tests/libecalc/core/models/compressor_modelling/test_compressor_train_common_shaft_utils.py rename to tests/libecalc/core/models/compressor_modelling/test_compressor_train_common_shaft_utils.py diff --git a/src/tests/libecalc/core/models/compressor_modelling/test_compressor_with_turbine.py b/tests/libecalc/core/models/compressor_modelling/test_compressor_with_turbine.py similarity index 100% rename from src/tests/libecalc/core/models/compressor_modelling/test_compressor_with_turbine.py rename to tests/libecalc/core/models/compressor_modelling/test_compressor_with_turbine.py diff --git a/src/tests/libecalc/core/models/compressor_modelling/test_fluid.py b/tests/libecalc/core/models/compressor_modelling/test_fluid.py similarity index 100% rename from src/tests/libecalc/core/models/compressor_modelling/test_fluid.py rename to tests/libecalc/core/models/compressor_modelling/test_fluid.py diff --git a/src/tests/libecalc/core/models/compressor_modelling/test_numeric_methods.py b/tests/libecalc/core/models/compressor_modelling/test_numeric_methods.py similarity index 100% rename from src/tests/libecalc/core/models/compressor_modelling/test_numeric_methods.py rename to tests/libecalc/core/models/compressor_modelling/test_numeric_methods.py diff --git a/src/tests/libecalc/core/models/compressor_modelling/test_simplified_compressor_train.py b/tests/libecalc/core/models/compressor_modelling/test_simplified_compressor_train.py similarity index 100% rename from src/tests/libecalc/core/models/compressor_modelling/test_simplified_compressor_train.py rename to tests/libecalc/core/models/compressor_modelling/test_simplified_compressor_train.py diff --git a/src/tests/libecalc/core/models/compressor_modelling/test_single_speed_compressor_train_common_shaft.py b/tests/libecalc/core/models/compressor_modelling/test_single_speed_compressor_train_common_shaft.py similarity index 100% rename from src/tests/libecalc/core/models/compressor_modelling/test_single_speed_compressor_train_common_shaft.py rename to tests/libecalc/core/models/compressor_modelling/test_single_speed_compressor_train_common_shaft.py diff --git a/src/tests/libecalc/core/models/compressor_modelling/test_variable_speed_compressor_train_common_shaft.py b/tests/libecalc/core/models/compressor_modelling/test_variable_speed_compressor_train_common_shaft.py similarity index 100% rename from src/tests/libecalc/core/models/compressor_modelling/test_variable_speed_compressor_train_common_shaft.py rename to tests/libecalc/core/models/compressor_modelling/test_variable_speed_compressor_train_common_shaft.py diff --git a/src/tests/libecalc/core/models/compressor_modelling/test_variable_speed_compressor_train_multiple_streams.py b/tests/libecalc/core/models/compressor_modelling/test_variable_speed_compressor_train_multiple_streams.py similarity index 100% rename from src/tests/libecalc/core/models/compressor_modelling/test_variable_speed_compressor_train_multiple_streams.py rename to tests/libecalc/core/models/compressor_modelling/test_variable_speed_compressor_train_multiple_streams.py diff --git a/src/tests/libecalc/core/models/test_consumer_tabular_energy_function.py b/tests/libecalc/core/models/test_consumer_tabular_energy_function.py similarity index 100% rename from src/tests/libecalc/core/models/test_consumer_tabular_energy_function.py rename to tests/libecalc/core/models/test_consumer_tabular_energy_function.py diff --git a/src/tests/libecalc/core/models/test_energy_function_results.py b/tests/libecalc/core/models/test_energy_function_results.py similarity index 100% rename from src/tests/libecalc/core/models/test_energy_function_results.py rename to tests/libecalc/core/models/test_energy_function_results.py diff --git a/src/tests/libecalc/core/models/test_fuel_model.py b/tests/libecalc/core/models/test_fuel_model.py similarity index 100% rename from src/tests/libecalc/core/models/test_fuel_model.py rename to tests/libecalc/core/models/test_fuel_model.py diff --git a/src/tests/libecalc/core/models/test_generator_model.py b/tests/libecalc/core/models/test_generator_model.py similarity index 100% rename from src/tests/libecalc/core/models/test_generator_model.py rename to tests/libecalc/core/models/test_generator_model.py diff --git a/src/tests/libecalc/core/models/test_pump.py b/tests/libecalc/core/models/test_pump.py similarity index 100% rename from src/tests/libecalc/core/models/test_pump.py rename to tests/libecalc/core/models/test_pump.py diff --git a/src/tests/libecalc/core/models/test_turbine.py b/tests/libecalc/core/models/test_turbine.py similarity index 100% rename from src/tests/libecalc/core/models/test_turbine.py rename to tests/libecalc/core/models/test_turbine.py diff --git a/src/tests/libecalc/core/models/test_validate_model_input.py b/tests/libecalc/core/models/test_validate_model_input.py similarity index 100% rename from src/tests/libecalc/core/models/test_validate_model_input.py rename to tests/libecalc/core/models/test_validate_model_input.py diff --git a/src/tests/libecalc/core/result/test_results.py b/tests/libecalc/core/result/test_results.py similarity index 100% rename from src/tests/libecalc/core/result/test_results.py rename to tests/libecalc/core/result/test_results.py diff --git a/src/tests/libecalc/dto/results/model/test_extend.py b/tests/libecalc/dto/results/model/test_extend.py similarity index 100% rename from src/tests/libecalc/dto/results/model/test_extend.py rename to tests/libecalc/dto/results/model/test_extend.py diff --git a/src/tests/libecalc/dto/results/model/test_requested_pressures_compressors.py b/tests/libecalc/dto/results/model/test_requested_pressures_compressors.py similarity index 100% rename from src/tests/libecalc/dto/results/model/test_requested_pressures_compressors.py rename to tests/libecalc/dto/results/model/test_requested_pressures_compressors.py diff --git a/src/tests/libecalc/dto/test_composition.py b/tests/libecalc/dto/test_composition.py similarity index 100% rename from src/tests/libecalc/dto/test_composition.py rename to tests/libecalc/dto/test_composition.py diff --git a/src/tests/libecalc/dto/test_electricity_consumer.py b/tests/libecalc/dto/test_electricity_consumer.py similarity index 100% rename from src/tests/libecalc/dto/test_electricity_consumer.py rename to tests/libecalc/dto/test_electricity_consumer.py diff --git a/src/tests/libecalc/dto/test_energy_model.py b/tests/libecalc/dto/test_energy_model.py similarity index 100% rename from src/tests/libecalc/dto/test_energy_model.py rename to tests/libecalc/dto/test_energy_model.py diff --git a/src/tests/libecalc/dto/test_fuel_consumer.py b/tests/libecalc/dto/test_fuel_consumer.py similarity index 100% rename from src/tests/libecalc/dto/test_fuel_consumer.py rename to tests/libecalc/dto/test_fuel_consumer.py diff --git a/src/tests/libecalc/dto/test_generator_set.py b/tests/libecalc/dto/test_generator_set.py similarity index 100% rename from src/tests/libecalc/dto/test_generator_set.py rename to tests/libecalc/dto/test_generator_set.py diff --git a/src/tests/libecalc/dto/utils/test_validators.py b/tests/libecalc/dto/utils/test_validators.py similarity index 100% rename from src/tests/libecalc/dto/utils/test_validators.py rename to tests/libecalc/dto/utils/test_validators.py diff --git a/src/tests/libecalc/expression/test_expression.py b/tests/libecalc/expression/test_expression.py similarity index 100% rename from src/tests/libecalc/expression/test_expression.py rename to tests/libecalc/expression/test_expression.py diff --git a/src/tests/libecalc/expression/test_expression_evaluator.py b/tests/libecalc/expression/test_expression_evaluator.py similarity index 100% rename from src/tests/libecalc/expression/test_expression_evaluator.py rename to tests/libecalc/expression/test_expression_evaluator.py diff --git a/src/tests/libecalc/input/mappers/test_consumer_chart.py b/tests/libecalc/input/mappers/test_consumer_chart.py similarity index 100% rename from src/tests/libecalc/input/mappers/test_consumer_chart.py rename to tests/libecalc/input/mappers/test_consumer_chart.py diff --git a/src/tests/libecalc/input/mappers/test_energy_usage_model.py b/tests/libecalc/input/mappers/test_energy_usage_model.py similarity index 100% rename from src/tests/libecalc/input/mappers/test_energy_usage_model.py rename to tests/libecalc/input/mappers/test_energy_usage_model.py diff --git a/src/tests/libecalc/input/mappers/test_facility_input.py b/tests/libecalc/input/mappers/test_facility_input.py similarity index 100% rename from src/tests/libecalc/input/mappers/test_facility_input.py rename to tests/libecalc/input/mappers/test_facility_input.py diff --git a/src/tests/libecalc/input/mappers/test_model_mapper.py b/tests/libecalc/input/mappers/test_model_mapper.py similarity index 100% rename from src/tests/libecalc/input/mappers/test_model_mapper.py rename to tests/libecalc/input/mappers/test_model_mapper.py diff --git a/src/tests/libecalc/input/mappers/test_resolve_fuel.py b/tests/libecalc/input/mappers/test_resolve_fuel.py similarity index 100% rename from src/tests/libecalc/input/mappers/test_resolve_fuel.py rename to tests/libecalc/input/mappers/test_resolve_fuel.py diff --git a/src/tests/libecalc/input/mappers/test_utils.py b/tests/libecalc/input/mappers/test_utils.py similarity index 100% rename from src/tests/libecalc/input/mappers/test_utils.py rename to tests/libecalc/input/mappers/test_utils.py diff --git a/src/tests/libecalc/input/mappers/variables_mapper/test_timeseries.py b/tests/libecalc/input/mappers/variables_mapper/test_timeseries.py similarity index 100% rename from src/tests/libecalc/input/mappers/variables_mapper/test_timeseries.py rename to tests/libecalc/input/mappers/variables_mapper/test_timeseries.py diff --git a/src/tests/libecalc/input/mappers/variables_mapper/test_timeseries_utils.py b/tests/libecalc/input/mappers/variables_mapper/test_timeseries_utils.py similarity index 100% rename from src/tests/libecalc/input/mappers/variables_mapper/test_timeseries_utils.py rename to tests/libecalc/input/mappers/variables_mapper/test_timeseries_utils.py diff --git a/src/tests/libecalc/input/mappers/variables_mapper/test_variables_mapper.py b/tests/libecalc/input/mappers/variables_mapper/test_variables_mapper.py similarity index 100% rename from src/tests/libecalc/input/mappers/variables_mapper/test_variables_mapper.py rename to tests/libecalc/input/mappers/variables_mapper/test_variables_mapper.py diff --git a/src/tests/libecalc/input/test_create_references.py b/tests/libecalc/input/test_create_references.py similarity index 100% rename from src/tests/libecalc/input/test_create_references.py rename to tests/libecalc/input/test_create_references.py diff --git a/src/tests/libecalc/input/test_file_io.py b/tests/libecalc/input/test_file_io.py similarity index 100% rename from src/tests/libecalc/input/test_file_io.py rename to tests/libecalc/input/test_file_io.py diff --git a/src/tests/libecalc/input/test_validation_errors.py b/tests/libecalc/input/test_validation_errors.py similarity index 100% rename from src/tests/libecalc/input/test_validation_errors.py rename to tests/libecalc/input/test_validation_errors.py diff --git a/src/tests/libecalc/input/test_yaml_configuration.py b/tests/libecalc/input/test_yaml_configuration.py similarity index 100% rename from src/tests/libecalc/input/test_yaml_configuration.py rename to tests/libecalc/input/test_yaml_configuration.py diff --git a/src/tests/libecalc/input/yaml_types/system/test_system_component_conditions.py b/tests/libecalc/input/yaml_types/system/test_system_component_conditions.py similarity index 100% rename from src/tests/libecalc/input/yaml_types/system/test_system_component_conditions.py rename to tests/libecalc/input/yaml_types/system/test_system_component_conditions.py diff --git a/src/tests/libecalc/input/yaml_types/test_yaml_variable.py b/tests/libecalc/input/yaml_types/test_yaml_variable.py similarity index 100% rename from src/tests/libecalc/input/yaml_types/test_yaml_variable.py rename to tests/libecalc/input/yaml_types/test_yaml_variable.py diff --git a/src/tests/libecalc/integration/snapshots/test_all_consumer_with_time_slots_models/test_all_consumer_with_time_slots_models_results/all_consumer_with_time_slots_models_v3.json b/tests/libecalc/integration/snapshots/test_all_consumer_with_time_slots_models/test_all_consumer_with_time_slots_models_results/all_consumer_with_time_slots_models_v3.json similarity index 100% rename from src/tests/libecalc/integration/snapshots/test_all_consumer_with_time_slots_models/test_all_consumer_with_time_slots_models_results/all_consumer_with_time_slots_models_v3.json rename to tests/libecalc/integration/snapshots/test_all_consumer_with_time_slots_models/test_all_consumer_with_time_slots_models_results/all_consumer_with_time_slots_models_v3.json diff --git a/src/tests/libecalc/integration/snapshots/test_all_energy_usage_models/test_all_results/all_energy_usage_models_v3.json b/tests/libecalc/integration/snapshots/test_all_energy_usage_models/test_all_results/all_energy_usage_models_v3.json similarity index 100% rename from src/tests/libecalc/integration/snapshots/test_all_energy_usage_models/test_all_results/all_energy_usage_models_v3.json rename to tests/libecalc/integration/snapshots/test_all_energy_usage_models/test_all_results/all_energy_usage_models_v3.json diff --git a/src/tests/libecalc/integration/snapshots/test_consumer_system_v2/test_compressor_system_v2_results/consumer_system_v2-consumer_system_v2_yaml/consumer_system_v2.json b/tests/libecalc/integration/snapshots/test_consumer_system_v2/test_compressor_system_v2_results/consumer_system_v2-consumer_system_v2_yaml/consumer_system_v2.json similarity index 100% rename from src/tests/libecalc/integration/snapshots/test_consumer_system_v2/test_compressor_system_v2_results/consumer_system_v2-consumer_system_v2_yaml/consumer_system_v2.json rename to tests/libecalc/integration/snapshots/test_consumer_system_v2/test_compressor_system_v2_results/consumer_system_v2-consumer_system_v2_yaml/consumer_system_v2.json diff --git a/src/tests/libecalc/integration/test_all_consumer_with_time_slots_models.py b/tests/libecalc/integration/test_all_consumer_with_time_slots_models.py similarity index 100% rename from src/tests/libecalc/integration/test_all_consumer_with_time_slots_models.py rename to tests/libecalc/integration/test_all_consumer_with_time_slots_models.py diff --git a/src/tests/libecalc/integration/test_all_energy_usage_models.py b/tests/libecalc/integration/test_all_energy_usage_models.py similarity index 100% rename from src/tests/libecalc/integration/test_all_energy_usage_models.py rename to tests/libecalc/integration/test_all_energy_usage_models.py diff --git a/src/tests/libecalc/integration/test_consumer_system_v2.py b/tests/libecalc/integration/test_consumer_system_v2.py similarity index 100% rename from src/tests/libecalc/integration/test_consumer_system_v2.py rename to tests/libecalc/integration/test_consumer_system_v2.py diff --git a/src/tests/libecalc/integration/test_minimal_is_valid.py b/tests/libecalc/integration/test_minimal_is_valid.py similarity index 100% rename from src/tests/libecalc/integration/test_minimal_is_valid.py rename to tests/libecalc/integration/test_minimal_is_valid.py diff --git a/src/tests/libecalc/integration/test_multiple_installations.py b/tests/libecalc/integration/test_multiple_installations.py similarity index 100% rename from src/tests/libecalc/integration/test_multiple_installations.py rename to tests/libecalc/integration/test_multiple_installations.py diff --git a/src/tests/libecalc/output/flow_diagram/conftest.py b/tests/libecalc/output/flow_diagram/conftest.py similarity index 100% rename from src/tests/libecalc/output/flow_diagram/conftest.py rename to tests/libecalc/output/flow_diagram/conftest.py diff --git a/src/tests/libecalc/output/flow_diagram/snapshots/test_ecalc_model_mapper/test_all_energy_usage_models/all_energy_usage_models_fde.json b/tests/libecalc/output/flow_diagram/snapshots/test_ecalc_model_mapper/test_all_energy_usage_models/all_energy_usage_models_fde.json similarity index 100% rename from src/tests/libecalc/output/flow_diagram/snapshots/test_ecalc_model_mapper/test_all_energy_usage_models/all_energy_usage_models_fde.json rename to tests/libecalc/output/flow_diagram/snapshots/test_ecalc_model_mapper/test_all_energy_usage_models/all_energy_usage_models_fde.json diff --git a/src/tests/libecalc/output/flow_diagram/snapshots/test_ecalc_model_mapper/test_case_with_dates/actual_fde.json b/tests/libecalc/output/flow_diagram/snapshots/test_ecalc_model_mapper/test_case_with_dates/actual_fde.json similarity index 100% rename from src/tests/libecalc/output/flow_diagram/snapshots/test_ecalc_model_mapper/test_case_with_dates/actual_fde.json rename to tests/libecalc/output/flow_diagram/snapshots/test_ecalc_model_mapper/test_case_with_dates/actual_fde.json diff --git a/src/tests/libecalc/output/flow_diagram/test_ecalc_model_mapper.py b/tests/libecalc/output/flow_diagram/test_ecalc_model_mapper.py similarity index 100% rename from src/tests/libecalc/output/flow_diagram/test_ecalc_model_mapper.py rename to tests/libecalc/output/flow_diagram/test_ecalc_model_mapper.py diff --git a/src/tests/libecalc/output/test_frequencies.py b/tests/libecalc/output/test_frequencies.py similarity index 100% rename from src/tests/libecalc/output/test_frequencies.py rename to tests/libecalc/output/test_frequencies.py diff --git a/src/tests/libecalc/presentation/exporter/formatters/test_csv_formatter.py b/tests/libecalc/presentation/exporter/formatters/test_csv_formatter.py similarity index 100% rename from src/tests/libecalc/presentation/exporter/formatters/test_csv_formatter.py rename to tests/libecalc/presentation/exporter/formatters/test_csv_formatter.py diff --git a/src/tests/libecalc/presentation/exporter/handlers/test_handlers.py b/tests/libecalc/presentation/exporter/handlers/test_handlers.py similarity index 100% rename from src/tests/libecalc/presentation/exporter/handlers/test_handlers.py rename to tests/libecalc/presentation/exporter/handlers/test_handlers.py diff --git a/src/tests/libecalc/presentation/exporter/test_ltp.py b/tests/libecalc/presentation/exporter/test_ltp.py similarity index 100% rename from src/tests/libecalc/presentation/exporter/test_ltp.py rename to tests/libecalc/presentation/exporter/test_ltp.py diff --git a/src/tests/libecalc/presentation/json_result/test_aggregators.py b/tests/libecalc/presentation/json_result/test_aggregators.py similarity index 100% rename from src/tests/libecalc/presentation/json_result/test_aggregators.py rename to tests/libecalc/presentation/json_result/test_aggregators.py diff --git a/src/tests/libecalc/presentation/simple_result/test_simple.py b/tests/libecalc/presentation/simple_result/test_simple.py similarity index 100% rename from src/tests/libecalc/presentation/simple_result/test_simple.py rename to tests/libecalc/presentation/simple_result/test_simple.py diff --git a/src/tests/libecalc/presentation/yaml/test_location.py b/tests/libecalc/presentation/yaml/test_location.py similarity index 100% rename from src/tests/libecalc/presentation/yaml/test_location.py rename to tests/libecalc/presentation/yaml/test_location.py diff --git a/src/tests/libecalc/presentation/yaml/test_venting_emitter.py b/tests/libecalc/presentation/yaml/test_venting_emitter.py similarity index 100% rename from src/tests/libecalc/presentation/yaml/test_venting_emitter.py rename to tests/libecalc/presentation/yaml/test_venting_emitter.py diff --git a/src/tests/libecalc/presentation/yaml/test_venting_emitter_validation_errors.py b/tests/libecalc/presentation/yaml/test_venting_emitter_validation_errors.py similarity index 100% rename from src/tests/libecalc/presentation/yaml/test_venting_emitter_validation_errors.py rename to tests/libecalc/presentation/yaml/test_venting_emitter_validation_errors.py diff --git a/src/tests/libecalc/presentation/yaml/test_yaml_model.py b/tests/libecalc/presentation/yaml/test_yaml_model.py similarity index 100% rename from src/tests/libecalc/presentation/yaml/test_yaml_model.py rename to tests/libecalc/presentation/yaml/test_yaml_model.py diff --git a/src/tests/libecalc/presentation/yaml/yaml_models/test_yaml_model_errors.py b/tests/libecalc/presentation/yaml/yaml_models/test_yaml_model_errors.py similarity index 100% rename from src/tests/libecalc/presentation/yaml/yaml_models/test_yaml_model_errors.py rename to tests/libecalc/presentation/yaml/yaml_models/test_yaml_model_errors.py diff --git a/src/tests/libecalc/presentation/yaml/yaml_types/models/conftest.py b/tests/libecalc/presentation/yaml/yaml_types/models/conftest.py similarity index 77% rename from src/tests/libecalc/presentation/yaml/yaml_types/models/conftest.py rename to tests/libecalc/presentation/yaml/yaml_types/models/conftest.py index fb7c666d8b..82211d8abf 100644 --- a/src/tests/libecalc/presentation/yaml/yaml_types/models/conftest.py +++ b/tests/libecalc/presentation/yaml/yaml_types/models/conftest.py @@ -1,4 +1,9 @@ -yaml_fluid_model = """ +import pytest + + +@pytest.fixture +def yaml_fluid_model(): + return """ - NAME: fluid_model TYPE: FLUID FLUID_MODEL_TYPE: PREDEFINED @@ -6,7 +11,10 @@ GAS_TYPE: MEDIUM """ -yaml_chart_single_speed = """ + +@pytest.fixture +def yaml_chart_single_speed(): + return """ - NAME: single_speed_compressor_chart TYPE: COMPRESSOR_CHART CHART_TYPE: SINGLE_SPEED @@ -21,7 +29,10 @@ EFFICIENCY: [0.72, 0.75, 0.74, 0.70] """ -yaml_chart_variable_speed = """ + +@pytest.fixture +def yaml_chart_variable_speed(): + return """ - NAME: variable_speed_compressor_chart TYPE: COMPRESSOR_CHART CHART_TYPE: VARIABLE_SPEED @@ -44,7 +55,10 @@ EFFICIENCY: [0.72, 0.73, 0.74, 0.74, 0.72, 0.70] """ -yaml_chart_generic_from_input = """ + +@pytest.fixture +def yaml_chart_generic_from_input(): + return """ - NAME: generic_from_input_compressor_chart TYPE: COMPRESSOR_CHART CHART_TYPE: GENERIC_FROM_INPUT @@ -53,7 +67,10 @@ EFFICIENCY: FRACTION """ -yaml_simplified_train_wrong_chart = f""" + +@pytest.fixture +def yaml_simplified_train_wrong_chart(yaml_fluid_model, yaml_chart_single_speed): + return f""" MODELS: {yaml_fluid_model} {yaml_chart_single_speed} @@ -66,7 +83,10 @@ COMPRESSOR_CHART: single_speed_compressor_chart """ -yaml_simplified_train_with_control_margin_and_pressure_drop = f""" + +@pytest.fixture +def yaml_simplified_train_with_control_margin_and_pressure_drop(yaml_fluid_model, yaml_chart_generic_from_input): + return f""" MODELS: {yaml_fluid_model} {yaml_chart_generic_from_input} @@ -82,7 +102,10 @@ COMPRESSOR_CHART: generic_from_input_compressor_chart """ -yaml_single_speed_train_without_control_margin = f""" + +@pytest.fixture +def yaml_single_speed_train_without_control_margin(yaml_fluid_model, yaml_chart_single_speed): + return f""" MODELS: {yaml_fluid_model} {yaml_chart_single_speed} @@ -96,7 +119,10 @@ PRESSURE_DROP_AHEAD_OF_STAGE: 2 """ -yaml_variable_speed_train_without_control_margin = f""" + +@pytest.fixture +def yaml_variable_speed_train_without_control_margin(yaml_fluid_model, yaml_chart_variable_speed): + return f""" MODELS: {yaml_fluid_model} {yaml_chart_variable_speed} diff --git a/src/tests/libecalc/presentation/yaml/yaml_types/models/test_model_reference_validation.py b/tests/libecalc/presentation/yaml/yaml_types/models/test_model_reference_validation.py similarity index 100% rename from src/tests/libecalc/presentation/yaml/yaml_types/models/test_model_reference_validation.py rename to tests/libecalc/presentation/yaml/yaml_types/models/test_model_reference_validation.py diff --git a/src/tests/libecalc/presentation/yaml/yaml_types/models/test_yaml_simplified_compressor_train.py b/tests/libecalc/presentation/yaml/yaml_types/models/test_yaml_simplified_compressor_train.py similarity index 92% rename from src/tests/libecalc/presentation/yaml/yaml_types/models/test_yaml_simplified_compressor_train.py rename to tests/libecalc/presentation/yaml/yaml_types/models/test_yaml_simplified_compressor_train.py index 133816dd07..7800635919 100644 --- a/src/tests/libecalc/presentation/yaml/yaml_types/models/test_yaml_simplified_compressor_train.py +++ b/tests/libecalc/presentation/yaml/yaml_types/models/test_yaml_simplified_compressor_train.py @@ -3,10 +3,6 @@ import pytest -from conftest import ( - yaml_simplified_train_with_control_margin_and_pressure_drop, - yaml_simplified_train_wrong_chart, -) from ecalc_cli.infrastructure.file_resource_service import FileResourceService from libecalc.common.time_utils import Frequency from libecalc.presentation.yaml.model import YamlModel @@ -15,7 +11,9 @@ from libecalc.presentation.yaml.yaml_keywords import EcalcYamlKeywords -def test_control_margin_and_pressure_drop_not_allowed(configuration_service_factory): +def test_control_margin_and_pressure_drop_not_allowed( + configuration_service_factory, yaml_simplified_train_with_control_margin_and_pressure_drop +): configuration_service = configuration_service_factory( ResourceStream(name="", stream=StringIO(yaml_simplified_train_with_control_margin_and_pressure_drop)) ) @@ -55,7 +53,7 @@ def test_control_margin_and_pressure_drop_not_allowed(configuration_service_fact ) -def test_single_speed_chart_not_allowed(configuration_service_factory): +def test_single_speed_chart_not_allowed(configuration_service_factory, yaml_simplified_train_wrong_chart): configuration_service = configuration_service_factory( ResourceStream(name="", stream=StringIO(yaml_simplified_train_wrong_chart)) ) diff --git a/src/tests/libecalc/presentation/yaml/yaml_types/models/test_yaml_single_speed_compressor_train.py b/tests/libecalc/presentation/yaml/yaml_types/models/test_yaml_single_speed_compressor_train.py similarity index 92% rename from src/tests/libecalc/presentation/yaml/yaml_types/models/test_yaml_single_speed_compressor_train.py rename to tests/libecalc/presentation/yaml/yaml_types/models/test_yaml_single_speed_compressor_train.py index aee5670bf9..3eb6c0b6a1 100644 --- a/src/tests/libecalc/presentation/yaml/yaml_types/models/test_yaml_single_speed_compressor_train.py +++ b/tests/libecalc/presentation/yaml/yaml_types/models/test_yaml_single_speed_compressor_train.py @@ -3,9 +3,6 @@ import pytest -from conftest import ( - yaml_single_speed_train_without_control_margin, -) from ecalc_cli.infrastructure.file_resource_service import FileResourceService from libecalc.common.time_utils import Frequency from libecalc.presentation.yaml.model import YamlModel @@ -14,7 +11,7 @@ from libecalc.presentation.yaml.yaml_keywords import EcalcYamlKeywords -def test_control_margin_required(configuration_service_factory): +def test_control_margin_required(configuration_service_factory, yaml_single_speed_train_without_control_margin): configuration_service = configuration_service_factory( ResourceStream(name="", stream=StringIO(yaml_single_speed_train_without_control_margin)) ) diff --git a/src/tests/libecalc/presentation/yaml/yaml_types/models/test_yaml_variable_speed_compressor_train.py b/tests/libecalc/presentation/yaml/yaml_types/models/test_yaml_variable_speed_compressor_train.py similarity index 92% rename from src/tests/libecalc/presentation/yaml/yaml_types/models/test_yaml_variable_speed_compressor_train.py rename to tests/libecalc/presentation/yaml/yaml_types/models/test_yaml_variable_speed_compressor_train.py index 28aa1bb56d..a85c1e1a85 100644 --- a/src/tests/libecalc/presentation/yaml/yaml_types/models/test_yaml_variable_speed_compressor_train.py +++ b/tests/libecalc/presentation/yaml/yaml_types/models/test_yaml_variable_speed_compressor_train.py @@ -3,9 +3,6 @@ import pytest -from conftest import ( - yaml_variable_speed_train_without_control_margin, -) from ecalc_cli.infrastructure.file_resource_service import FileResourceService from libecalc.common.time_utils import Frequency from libecalc.presentation.yaml.model import YamlModel @@ -14,7 +11,7 @@ from libecalc.presentation.yaml.yaml_keywords import EcalcYamlKeywords -def test_control_margin_required(configuration_service_factory): +def test_control_margin_required(configuration_service_factory, yaml_variable_speed_train_without_control_margin): configuration_service = configuration_service_factory( ResourceStream(name="", stream=StringIO(yaml_variable_speed_train_without_control_margin)) ) diff --git a/src/tests/libecalc/presentation/yaml/yaml_types/test_categories.py b/tests/libecalc/presentation/yaml/yaml_types/test_categories.py similarity index 100% rename from src/tests/libecalc/presentation/yaml/yaml_types/test_categories.py rename to tests/libecalc/presentation/yaml/yaml_types/test_categories.py diff --git a/src/tests/libecalc/presentation/yaml/yaml_types/test_missing_files.py b/tests/libecalc/presentation/yaml/yaml_types/test_missing_files.py similarity index 100% rename from src/tests/libecalc/presentation/yaml/yaml_types/test_missing_files.py rename to tests/libecalc/presentation/yaml/yaml_types/test_missing_files.py