Optionally read Arbin into in-memory sqlite without temporary file

This commit is contained in:
Matthew Evans
2024-02-12 10:53:25 +00:00
parent 1fd9f8454a
commit a845731131
2 changed files with 34 additions and 2 deletions

View File

@@ -53,6 +53,21 @@ def test_convert_Arbin_to_sqlite_function(testdata_dir, tmpdir, basename):
csr.fetchone()
@pytest.mark.parametrize("basename", ["arbin1", "UM34_Test005E"])
def test_convert_Arbin_to_sqlite_function_in_memory(testdata_dir, tmpdir, basename):
"""Convert an Arbin file to an in-memory SQLite database."""
res_file = os.path.join(testdata_dir, basename + ".res")
conn = None
try:
conn = res2sqlite.convert_arbin_to_sqlite(res_file)
assert conn is not None
csr = conn.execute("SELECT * FROM Channel_Normal_Table;")
csr.fetchone()
finally:
if conn is not None:
conn.close()
@pytest.mark.skipif(
not have_mdbtools, reason="Reading the Arbin file requires MDBTools"
)