From a467f64ca94487028298cdb3b454b649367141c3 Mon Sep 17 00:00:00 2001 From: Kieron Taylor Date: Fri, 14 Jun 2024 14:19:35 +0000 Subject: [PATCH] Remove the now unused test data factory fixture. --- tests/fixtures/inbox_data.py | 101 ----------------------------------- 1 file changed, 101 deletions(-) diff --git a/tests/fixtures/inbox_data.py b/tests/fixtures/inbox_data.py index 64379b1..680d3af 100644 --- a/tests/fixtures/inbox_data.py +++ b/tests/fixtures/inbox_data.py @@ -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="zx80@example.com") - other_user = User(username="cd32@example.com") - 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