Skip to content
This repository has been archived by the owner on May 17, 2024. It is now read-only.

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
  • Loading branch information
erezsh committed Nov 24, 2022
1 parent 374adeb commit ca4c9e3
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@

from data_diff.databases import MySQL
from data_diff.sqeleton.queries import table, commit
from data_diff.sqeleton.queries.api import current_timestamp
from data_diff.sqeleton.queries.ast_classes import Code

from .common import TEST_MYSQL_CONN_STRING, get_conn, DiffTestCase, table_segment
from .common import TEST_MYSQL_CONN_STRING, get_conn


def _commit(conn):
Expand Down Expand Up @@ -43,14 +41,13 @@ def setUp(self) -> None:
src_table = table(table_src_name, schema={"id": int, "datetime": datetime, "text_comment": str})
self.conn.query(src_table.create())
self.conn.query("SET @@session.time_zone='+00:00'")
db_time = self.conn.query("select now()", datetime)
now = arrow.get(db_time)
now = self.conn.query("select now()", datetime)

rows = [
(now, "now"),
(now.shift(seconds=-10), "a"),
(now.shift(seconds=-7), "b"),
(now.shift(seconds=-6), "c"),
(now - timedelta(seconds=10), "a"),
(now - timedelta(seconds=7), "b"),
(now - timedelta(seconds=6), "c"),
]

self.conn.query(src_table.insert_rows((i, ts.datetime, s) for i, (ts, s) in enumerate(rows)))
Expand All @@ -59,7 +56,7 @@ def setUp(self) -> None:
self.conn.query(self.table_dst.create(self.table_src))
_commit(self.conn)

self.conn.query(src_table.insert_row(len(rows), now.shift(seconds=-3).datetime, "3 seconds ago"))
self.conn.query(src_table.insert_row(len(rows), now - timedelta(seconds=3).datetime, "3 seconds ago"))
_commit(self.conn)

def tearDown(self) -> None:
Expand Down

0 comments on commit ca4c9e3

Please sign in to comment.