3
3
import sys
4
4
from datetime import datetime , timedelta
5
5
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
8
7
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
10
10
11
11
12
12
def run_datadiff_cli (* args ):
@@ -20,14 +20,14 @@ def run_datadiff_cli(*args):
20
20
return stdout .splitlines ()
21
21
22
22
23
+ @test_each_database
23
24
class TestCLI (DiffTestCase ):
24
- db_cls = MySQL
25
25
src_schema = {"id" : int , "datetime" : datetime , "text_comment" : str }
26
26
27
27
def setUp (self ) -> None :
28
28
super ().setUp ()
29
29
30
- now = self .connection .query ("select now()" , datetime )
30
+ now = self .connection .query (current_timestamp () , datetime )
31
31
32
32
rows = [
33
33
(now , "now" ),
@@ -46,16 +46,18 @@ def setUp(self) -> None:
46
46
)
47
47
48
48
def test_basic (self ):
49
+ conn_str = CONN_STRINGS [self .db_cls ]
49
50
diff = run_datadiff_cli (
50
- TEST_MYSQL_CONN_STRING , self .table_src_name , TEST_MYSQL_CONN_STRING , self .table_dst_name
51
+ conn_str , self .table_src_name , conn_str , self .table_dst_name
51
52
)
52
53
assert len (diff ) == 1
53
54
54
55
def test_options (self ):
56
+ conn_str = CONN_STRINGS [self .db_cls ]
55
57
diff = run_datadiff_cli (
56
- TEST_MYSQL_CONN_STRING ,
58
+ conn_str ,
57
59
self .table_src_name ,
58
- TEST_MYSQL_CONN_STRING ,
60
+ conn_str ,
59
61
self .table_dst_name ,
60
62
"--bisection-factor" ,
61
63
"16" ,
0 commit comments