Skip to content

Commit

Permalink
Fix merge errors with #1060 and #1062
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-thom committed Mar 6, 2024
1 parent d530d20 commit c03fac8
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 38 deletions.
45 changes: 22 additions & 23 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ using DataStructures
import UUIDs
using Random
import Serialization
using Base.Filesystem

# Code Quality Tests
import Aqua
Expand Down Expand Up @@ -55,28 +54,28 @@ const LOG_FILE = "power-simulations-test.log"
ENV["RUNNING_PSI_TESTS"] = "true"

const DISABLED_TEST_FILES = [
# "test_basic_model_structs.jl",
# "test_device_branch_constructors.jl",
# "test_device_hydro_generation_constructors.jl",
# "test_device_load_constructors.jl",
# "test_device_hybrid_generation_constructors.jl",
# "test_device_renewable_generation_constructors.jl",
# "test_device_storage_constructors.jl",
# "test_device_thermal_generation_constructors.jl",
# "test_jump_model_utils.jl",
# "test_model_decision.jl",
# "test_problem_template.jl",
# "test_model_emulation.jl",
# "test_network_constructors.jl",
"test_services_constructor.jl",
# "test_simulation_models.jl",
# "test_simulation_sequence.jl",
# "test_simulation_build.jl",
# "test_initialization_problem.jl",
# "test_simulation_execute.jl",
# "test_simulation_results.jl",
# "test_simulation_results_export.jl",
# "test_simulation_store.jl",
# "test_basic_model_structs.jl",
# "test_device_branch_constructors.jl",
# "test_device_hydro_generation_constructors.jl",
# "test_device_load_constructors.jl",
# "test_device_hybrid_generation_constructors.jl",
# "test_device_renewable_generation_constructors.jl",
# "test_device_storage_constructors.jl",
# "test_device_thermal_generation_constructors.jl",
# "test_jump_model_utils.jl",
# "test_model_decision.jl",
# "test_problem_template.jl",
# "test_model_emulation.jl",
# "test_network_constructors.jl",
"test_services_constructor.jl",
# "test_simulation_models.jl",
# "test_simulation_sequence.jl",
# "test_simulation_build.jl",
# "test_initialization_problem.jl",
# "test_simulation_execute.jl",
# "test_simulation_results.jl",
# "test_simulation_results_export.jl",
# "test_simulation_store.jl",
]

LOG_LEVELS = Dict(
Expand Down
42 changes: 27 additions & 15 deletions test/test_simulation_results.jl
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,13 @@ function test_simulation_results(
)
results = SimulationResults(sim)
test_decision_problem_results(results, c_sys5_hy_ed, c_sys5_hy_uc, in_memory)
if !in_memory
test_decision_problem_results_kwargs_handling(
dirname(results.path),
c_sys5_hy_ed,
c_sys5_hy_uc,
)
end
test_emulation_problem_results(results, in_memory)

results_ed = get_decision_problem_results(results, "ED")
Expand Down Expand Up @@ -855,6 +862,26 @@ function test_simulation_results_from_file(path::AbstractString, c_sys5_hy_ed, c
@test get_system(results_uc) === nothing
@test length(read_realized_variables(results_uc)) == length(UC_EXPECTED_VARS)

@test_throws IS.InvalidValue set_system!(results_uc, c_sys5_hy_ed)
set_system!(results_ed, c_sys5_hy_ed)
set_system!(results_uc, c_sys5_hy_uc)

test_decision_problem_results_values(results_ed, results_uc, c_sys5_hy_ed, c_sys5_hy_uc)
end

function test_decision_problem_results_kwargs_handling(
path::AbstractString,
c_sys5_hy_ed,
c_sys5_hy_uc,
)
results = SimulationResults(path, "no_cache")
@test list_decision_problems(results) == ["ED", "UC"]
results_uc = get_decision_problem_results(results, "UC")
results_ed = get_decision_problem_results(results, "ED")

# Verify this works without system.
@test get_system(results_uc) === nothing

results_ed = get_decision_problem_results(results, "ED")
@test isnothing(get_system(results_ed))

Expand All @@ -864,21 +891,6 @@ function test_simulation_results_from_file(path::AbstractString, c_sys5_hy_ed, c

@test_throws IS.InvalidValue set_system!(results_uc, c_sys5_hy_ed)

current_file = joinpath(
results_uc.execution_path,
"problems",
results_uc.problem,
PSI.make_system_filename(results_uc.system_uuid),
)
mv(current_file, "system-temporary-file-name.json"; force = true)

@test_throws ErrorException get_decision_problem_results(
results,
"UC";
populate_system = true,
)
mv("system-temporary-file-name.json", current_file)

set_system!(results_ed, c_sys5_hy_ed)
set_system!(results_uc, c_sys5_hy_uc)

Expand Down

0 comments on commit c03fac8

Please sign in to comment.