|
21 | 21 | from qcodes.dataset.descriptions.param_spec import ParamSpecBase
|
22 | 22 | from qcodes.dataset.descriptions.rundescriber import RunDescriber
|
23 | 23 | from qcodes.dataset.guids import parse_guid
|
24 |
| -from qcodes.dataset.sqlite.connection import path_to_dbfile |
| 24 | +from qcodes.dataset.sqlite.connection import path_to_dbfile, atomic |
25 | 25 | from qcodes.dataset.sqlite.database import get_DB_location
|
26 |
| -from qcodes.dataset.sqlite.queries import _unicode_categories |
| 26 | +from qcodes.dataset.sqlite.queries import _unicode_categories, _rewrite_timestamps |
27 | 27 | from qcodes.tests.common import error_caused_by
|
28 | 28 | from qcodes.tests.dataset.helper_functions import verify_data_dict
|
29 | 29 | from qcodes.tests.dataset.test_links import generate_some_links
|
@@ -198,6 +198,22 @@ def test_timestamps_are_none():
|
198 | 198 | assert isinstance(ds.run_timestamp(), str)
|
199 | 199 |
|
200 | 200 |
|
| 201 | +@pytest.mark.usefixtures('experiment') |
| 202 | +def test_integer_timestamps_in_database_are_supported(): |
| 203 | + ds = DataSet() |
| 204 | + |
| 205 | + ds.mark_started() |
| 206 | + ds.mark_completed() |
| 207 | + |
| 208 | + with atomic(ds.conn) as conn: |
| 209 | + _rewrite_timestamps(conn, ds.run_id, 42, 69) |
| 210 | + |
| 211 | + assert isinstance(ds.run_timestamp_raw, float) |
| 212 | + assert isinstance(ds.completed_timestamp_raw, float) |
| 213 | + assert isinstance(ds.run_timestamp(), str) |
| 214 | + assert isinstance(ds.completed_timestamp(), str) |
| 215 | + |
| 216 | + |
201 | 217 | def test_dataset_read_only_properties(dataset):
|
202 | 218 | read_only_props = ['run_id', 'path_to_db', 'name', 'table_name', 'guid',
|
203 | 219 | 'number_of_results', 'counter', 'parameters',
|
|
0 commit comments