mirror of
https://gitlab.cern.ch/wotsubo/PSBoardDataBase.git
synced 2025-06-08 14:05:40 +09:00
- add_qaqc_runlist_from_masterlogs works only when all of the master logs are located. but CI doesn't since log files are not included in the repo
67 lines
2.6 KiB
Julia
67 lines
2.6 KiB
Julia
using Test
|
|
using PSBoardDataBase
|
|
using CSV, DataFrames
|
|
using Dates
|
|
|
|
true || include("../src/PSBoardDataBase.jl")
|
|
|
|
@testset "PSBoardDataBase" begin
|
|
@testset "parse master log" begin
|
|
masterlog_metadata::PSBoardDataBase.QaqcMasterLog.QaqcMasterLogMetadata =
|
|
PSBoardDataBase.QaqcMasterLog.parse_master_log("input/log/57_long.log")
|
|
@test masterlog_metadata.shifters == "Otsubo"
|
|
@test masterlog_metadata.timestamp == DateTime(2024, 07, 26, 10, 33, 05)
|
|
@test masterlog_metadata.runid == 57
|
|
@test masterlog_metadata.shiftscript_version == v"1.0.2"
|
|
end
|
|
|
|
@testset "prepare dataframe" begin
|
|
single_result_df =
|
|
CSV.read("input/PS board QAQC Data Base - 本番1回試験・追加検証試験.csv", DataFrame)
|
|
@test PSBoardDataBase.prepare_single_result_df(single_result_df) isa DataFrame
|
|
|
|
@test PSBoardDataBase.prepare_dispatch_table(
|
|
CSV.read("input/PS board QAQC Data Base - 出荷.csv", DataFrame),
|
|
) isa DataFrame
|
|
|
|
@test PSBoardDataBase.prepare_100test_table(
|
|
CSV.read("input/PS board QAQC Data Base - 100回試験結果.csv", DataFrame),
|
|
) isa DataFrame
|
|
end
|
|
|
|
@testset "full integrated test" begin
|
|
dbpath = tempname()
|
|
db = PSBoardDataBase.create_database(dbpath)
|
|
@info "" db
|
|
|
|
@test PSBoardDataBase.insert_qaqc_campaign_id(db) |> isnothing
|
|
@test PSBoardDataBase.insert_qaqc_positions(db) |> isnothing
|
|
|
|
single_result_df =
|
|
CSV.read("input/PS board QAQC Data Base - 本番1回試験・追加検証試験.csv", DataFrame)
|
|
runlist_table = CSV.read("input/PS board QAQC Data Base - RUNLIST.csv", DataFrame)
|
|
|
|
@test PSBoardDataBase.add_psboard_ids(db, single_result_df) |> isnothing
|
|
@test PSBoardDataBase.add_qaqc_runlist(db, runlist_table) |> isnothing
|
|
|
|
@test PSBoardDataBase.add_qaqc_single_result(db, single_result_df, runlist_table) |>
|
|
isnothing
|
|
|
|
dispatch_table = CSV.read("input/PS board QAQC Data Base - 出荷.csv", DataFrame)
|
|
|
|
@test PSBoardDataBase.add_qaqc_dispatch(db, dispatch_table) |> isnothing
|
|
|
|
if haskey(ENV, "LOCAL_TEST")
|
|
@test PSBoardDataBase.add_qaqc_runlist_from_masterlogs(db, "input/log/") |>
|
|
isnothing
|
|
|
|
extra_100test_result_df =
|
|
CSV.read("input/PS board QAQC Data Base - 100回試験結果.csv", DataFrame)
|
|
|
|
@test PSBoardDataBase.add_qaqc_100test_result(db, extra_100test_result_df) |>
|
|
isnothing
|
|
|
|
run(`sqlitebrowser $dbpath`)
|
|
end
|
|
end
|
|
end
|