Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the now unused test data factory fixture. #230

Merged
merged 1 commit into from
Jun 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 0 additions & 101 deletions tests/fixtures/inbox_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,104 +97,3 @@ def inbox_data(mlwhdb_test_session):
mlwhdb_test_session.commit()

yield True


@pytest.fixture()
def test_data_factory(mlwhdb_test_session, qcdb_test_session):
def setup_data(desired_wells):
# Setup dicts and "filler" data

library_qc_type = QcType(
qc_type="library", description="Sample/library evaluation"
)
seq_qc_type = QcType(
qc_type="sequencing", description="Sequencing process evaluation"
)

run_name_attr = SubProductAttr(
attr_name="run_name", description="PacBio run name."
)
well_label_attr = SubProductAttr(
attr_name="well_label", description="PacBio well label"
)
seq_platform = SeqPlatform(name="PacBio", description="Pacific Biosciences.")
user = User(username="[email protected]")
other_user = User(username="[email protected]")
states = ["Passed", "Failed", "Claimed", "On hold", "Aborted"]
state_dicts = {}

for state in states:
outcome = None
if state == "Passed":
outcome = True
elif state == "Failed":
outcome = False
state_dicts[state] = QcStateDict(state=state, outcome=outcome)

qcdb_test_session.add_all(state_dicts.values())
qcdb_test_session.add_all(
[
library_qc_type,
seq_qc_type,
run_name_attr,
well_label_attr,
seq_platform,
user,
other_user,
]
)

# Start adding the PacBioRunWellMetrics and QcState rows.
for run_name, wells in desired_wells.items():
for well_label, state in wells.items():

pbe = PacBioEntity(run_name=run_name, well_label=well_label)
id = pbe.hash_product_id()

run_metrics = PacBioRunWellMetrics(
pac_bio_run_name=run_name,
well_label=well_label,
id_pac_bio_product=id,
instrument_type="PacBio",
polymerase_num_reads=1337,
ccs_execution_mode="None",
well_status="Complete",
run_start=datetime.now() - timedelta(days=3),
run_complete=datetime.now() - timedelta(days=1),
well_start=datetime.now() - timedelta(days=2),
well_complete=datetime.now() - timedelta(days=1),
)
mlwhdb_test_session.add(run_metrics)

if state is not None:

qc_state = QcState(
created_by="me",
is_preliminary=state in ["On hold", "Claimed"],
qc_state_dict=state_dicts[state],
qc_type=seq_qc_type,
seq_product=SeqProduct(
id_product=id,
seq_platform=seq_platform,
sub_products=[
SubProduct(
sub_product_attr=run_name_attr,
sub_product_attr_=well_label_attr,
value_attr_one=run_name,
value_attr_two=well_label,
properties_digest=id,
),
],
),
user=user,
)
qcdb_test_session.add(qc_state)
# Feed back to fixture use
desired_wells[run_name][well_label] = qc_state

qcdb_test_session.commit()
mlwhdb_test_session.commit()

return desired_wells

yield setup_data