def test_perform_actual_upgrade_4_to_5(db_file):
    v4fixpath = os.path.join(fixturepath, 'db_files', 'version4')

    db_file += '.db'
    dbname_old = os.path.join(v4fixpath, db_file)

    if not os.path.exists(dbname_old):
        pytest.skip("No db-file fixtures found. You can generate test db-files"
                    " using the scripts in the "
                    "https://github.com/QCoDeS/qcodes_generate_test_db/ repo")

    with temporarily_copied_DB(dbname_old, debug=False, version=4) as conn:
        # firstly, assert the situation with 'snapshot' column of 'runs' table
        if 'with_runs_and_snapshots' in db_file:
            assert is_column_in_table(conn, 'runs', 'snapshot')
        else:
            assert not is_column_in_table(conn, 'runs', 'snapshot')

        # secondly, perform the upgrade
        perform_db_upgrade_4_to_5(conn)

        # finally, assert the 'snapshot' column exists in 'runs' table
        assert is_column_in_table(conn, 'runs', 'snapshot')
def test_perform_actual_upgrade_7_to_8(db_file):
    v7fixpath = os.path.join(fixturepath, 'db_files', 'version7')

    db_file += '.db'
    dbname_old = os.path.join(v7fixpath, db_file)

    if not os.path.exists(dbname_old):
        pytest.skip("No db-file fixtures found. You can generate test db-files"
                    " using the scripts in the "
                    "https://github.com/QCoDeS/qcodes_generate_test_db/ repo")

    with temporarily_copied_DB(dbname_old, debug=False, version=7) as conn:

        perform_db_upgrade_7_to_8(conn)

        assert is_column_in_table(conn, 'runs', 'parent_datasets')
Beispiel #3
0
def test_column_in_table(dataset):
    assert mut_help.is_column_in_table(dataset.conn, "runs", "run_id")
    assert not mut_help.is_column_in_table(dataset.conn, "runs",
                                           "non-existing-column")