Skip to content
Snippets Groups Projects
Commit 18cdf7e2 authored by Christoph Alt's avatar Christoph Alt
Browse files

added a test to test the time conversion

parent 31092c93
No related merge requests found
import pytest
from cbutil.postprocessing.sqlite_helper import (select_stmt,
from_stmt,
where_stmt,
join_stmt,
table_name_query,
query_builder,
)
from datetime import datetime
from cbutil.postprocessing.sqlite import (get_all_table_names,
tables2dict,
query_join,
iterate_all_tables,
build_iterate_query)
import pytest
from cbutil.postprocessing.sqlite import sqlite_context
from cbutil.postprocessing.sqlite import (build_iterate_query,
get_all_table_names,
iterate_all_tables, query_join,
sqlite_context, tables2dict)
from cbutil.postprocessing.sqlite_helper import (from_stmt, join_stmt,
query_builder, select_stmt,
table_name_query, where_stmt)
from cbutil.util import time_conversion
def test_select():
......@@ -91,3 +87,13 @@ def test_build_iterate():
for res in build_iterate_query(connection, from_table="timingPool",
where_args=["runId", 1]):
pass
def test_time_stamp():
pattern = "%Y-%m-%d %H:%M:%S"
with sqlite_context("tests/benchmark.sqlite") as connection:
dicts = list(tables2dict(query_join(connection, "runs", "timingPool", "runId")))
for run in dicts:
ts = time_conversion(run["timestamp"], pattern=pattern)
date = datetime.fromtimestamp(ts).strftime(pattern)
assert run["timestamp"] == date
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment