33import sys
44from datetime import datetime , timedelta
55
6- from data_diff .databases import MySQL
7- from data_diff .sqeleton .queries import commit
6+ from data_diff .sqeleton .queries import commit , current_timestamp
87
9- from .common import TEST_MYSQL_CONN_STRING , DiffTestCase
8+ from .common import DiffTestCase , CONN_STRINGS
9+ from .test_diff_tables import test_each_database
1010
1111
1212def run_datadiff_cli (* args ):
@@ -20,14 +20,14 @@ def run_datadiff_cli(*args):
2020 return stdout .splitlines ()
2121
2222
23+ @test_each_database
2324class TestCLI (DiffTestCase ):
24- db_cls = MySQL
2525 src_schema = {"id" : int , "datetime" : datetime , "text_comment" : str }
2626
2727 def setUp (self ) -> None :
2828 super ().setUp ()
2929
30- now = self .connection .query ("select now()" , datetime )
30+ now = self .connection .query (current_timestamp () , datetime )
3131
3232 rows = [
3333 (now , "now" ),
@@ -46,16 +46,16 @@ def setUp(self) -> None:
4646 )
4747
4848 def test_basic (self ):
49- diff = run_datadiff_cli (
50- TEST_MYSQL_CONN_STRING , self .table_src_name , TEST_MYSQL_CONN_STRING , self .table_dst_name
51- )
49+ conn_str = CONN_STRINGS [self .db_cls ]
50+ diff = run_datadiff_cli (conn_str , self .table_src_name , conn_str , self .table_dst_name )
5251 assert len (diff ) == 1
5352
5453 def test_options (self ):
54+ conn_str = CONN_STRINGS [self .db_cls ]
5555 diff = run_datadiff_cli (
56- TEST_MYSQL_CONN_STRING ,
56+ conn_str ,
5757 self .table_src_name ,
58- TEST_MYSQL_CONN_STRING ,
58+ conn_str ,
5959 self .table_dst_name ,
6060 "--bisection-factor" ,
6161 "16" ,
@@ -68,4 +68,4 @@ def test_options(self):
6868 "--max-age" ,
6969 "1h" ,
7070 )
71- assert len (diff ) == 1
71+ assert len (diff ) == 1 , diff
0 commit comments