@@ -196,10 +196,14 @@ def test_execute_async__long_running(self):
196
196
197
197
assert result [0 ].asDict () == {"count(1)" : 0 }
198
198
199
- def test_execute_async__small_result (self ):
199
+ @pytest .mark .parametrize ("extra_params" , [
200
+ {},
201
+ {"use_sea" : True , "use_cloud_fetch" : False }
202
+ ])
203
+ def test_execute_async__small_result (self , extra_params ):
200
204
small_result_query = "SELECT 1"
201
205
202
- with self .cursor () as cursor :
206
+ with self .cursor (extra_params ) as cursor :
203
207
cursor .execute_async (small_result_query )
204
208
205
209
## Fake sleep for 5 secs
@@ -328,8 +332,12 @@ def test_incorrect_query_throws_exception(self):
328
332
cursor .execute ("CREATE TABLE IF NOT EXISTS TABLE table_234234234" )
329
333
assert "table_234234234" in str (cm .value )
330
334
331
- def test_create_table_will_return_empty_result_set (self ):
332
- with self .cursor ({}) as cursor :
335
+ @pytest .mark .parametrize ("extra_params" , [
336
+ {},
337
+ {"use_sea" : True , "use_cloud_fetch" : False }
338
+ ])
339
+ def test_create_table_will_return_empty_result_set (self , extra_params ):
340
+ with self .cursor (extra_params ) as cursor :
333
341
table_name = "table_{uuid}" .format (uuid = str (uuid4 ()).replace ("-" , "_" ))
334
342
try :
335
343
cursor .execute (
@@ -341,8 +349,12 @@ def test_create_table_will_return_empty_result_set(self):
341
349
finally :
342
350
cursor .execute ("DROP TABLE IF EXISTS {}" .format (table_name ))
343
351
344
- def test_get_tables (self ):
345
- with self .cursor ({}) as cursor :
352
+ @pytest .mark .parametrize ("extra_params" , [
353
+ {},
354
+ {"use_sea" : True , "use_cloud_fetch" : False }
355
+ ])
356
+ def test_get_tables (self , extra_params ):
357
+ with self .cursor (extra_params ) as cursor :
346
358
table_name = "table_{uuid}" .format (uuid = str (uuid4 ()).replace ("-" , "_" ))
347
359
table_names = [table_name + "_1" , table_name + "_2" ]
348
360
@@ -387,8 +399,12 @@ def test_get_tables(self):
387
399
for table in table_names :
388
400
cursor .execute ("DROP TABLE IF EXISTS {}" .format (table ))
389
401
390
- def test_get_columns (self ):
391
- with self .cursor ({}) as cursor :
402
+ @pytest .mark .parametrize ("extra_params" , [
403
+ {},
404
+ {"use_sea" : True , "use_cloud_fetch" : False }
405
+ ])
406
+ def test_get_columns (self , extra_params ):
407
+ with self .cursor (extra_params ) as cursor :
392
408
table_name = "table_{uuid}" .format (uuid = str (uuid4 ()).replace ("-" , "_" ))
393
409
table_names = [table_name + "_1" , table_name + "_2" ]
394
410
@@ -474,8 +490,12 @@ def test_get_columns(self):
474
490
for table in table_names :
475
491
cursor .execute ("DROP TABLE IF EXISTS {}" .format (table ))
476
492
477
- def test_escape_single_quotes (self ):
478
- with self .cursor ({}) as cursor :
493
+ @pytest .mark .parametrize ("extra_params" , [
494
+ {},
495
+ {"use_sea" : True , "use_cloud_fetch" : False }
496
+ ])
497
+ def test_escape_single_quotes (self , extra_params ):
498
+ with self .cursor (extra_params ) as cursor :
479
499
table_name = "table_{uuid}" .format (uuid = str (uuid4 ()).replace ("-" , "_" ))
480
500
# Test escape syntax directly
481
501
cursor .execute (
@@ -499,8 +519,12 @@ def test_escape_single_quotes(self):
499
519
rows = cursor .fetchall ()
500
520
assert rows [0 ]["col_1" ] == "you're"
501
521
502
- def test_get_schemas (self ):
503
- with self .cursor ({}) as cursor :
522
+ @pytest .mark .parametrize ("extra_params" , [
523
+ {},
524
+ {"use_sea" : True , "use_cloud_fetch" : False }
525
+ ])
526
+ def test_get_schemas (self , extra_params ):
527
+ with self .cursor (extra_params ) as cursor :
504
528
database_name = "db_{uuid}" .format (uuid = str (uuid4 ()).replace ("-" , "_" ))
505
529
try :
506
530
cursor .execute ("CREATE DATABASE IF NOT EXISTS {}" .format (database_name ))
@@ -517,8 +541,12 @@ def test_get_schemas(self):
517
541
finally :
518
542
cursor .execute ("DROP DATABASE IF EXISTS {}" .format (database_name ))
519
543
520
- def test_get_catalogs (self ):
521
- with self .cursor ({}) as cursor :
544
+ @pytest .mark .parametrize ("extra_params" , [
545
+ {},
546
+ {"use_sea" : True , "use_cloud_fetch" : False }
547
+ ])
548
+ def test_get_catalogs (self , extra_params ):
549
+ with self .cursor (extra_params ) as cursor :
522
550
cursor .catalogs ()
523
551
cursor .fetchall ()
524
552
catalogs_desc = cursor .description
@@ -527,27 +555,39 @@ def test_get_catalogs(self):
527
555
]
528
556
529
557
@skipUnless (pysql_supports_arrow (), "arrow test need arrow support" )
530
- def test_get_arrow (self ):
558
+ @pytest .mark .parametrize ("extra_params" , [
559
+ {},
560
+ {"use_sea" : True , "use_cloud_fetch" : False }
561
+ ])
562
+ def test_get_arrow (self , extra_params ):
531
563
# These tests are quite light weight as the arrow fetch methods are used internally
532
564
# by everything else
533
- with self .cursor ({} ) as cursor :
565
+ with self .cursor (extra_params ) as cursor :
534
566
cursor .execute ("SELECT * FROM range(10)" )
535
567
table_1 = cursor .fetchmany_arrow (1 ).to_pydict ()
536
568
assert table_1 == OrderedDict ([("id" , [0 ])])
537
569
538
570
table_2 = cursor .fetchall_arrow ().to_pydict ()
539
571
assert table_2 == OrderedDict ([("id" , [1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 ])])
540
572
541
- def test_unicode (self ):
573
+ @pytest .mark .parametrize ("extra_params" , [
574
+ {},
575
+ {"use_sea" : True , "use_cloud_fetch" : False }
576
+ ])
577
+ def test_unicode (self , extra_params ):
542
578
unicode_str = "数据砖"
543
- with self .cursor ({} ) as cursor :
579
+ with self .cursor (extra_params ) as cursor :
544
580
cursor .execute ("SELECT '{}'" .format (unicode_str ))
545
581
results = cursor .fetchall ()
546
582
assert len (results ) == 1 and len (results [0 ]) == 1
547
583
assert results [0 ][0 ] == unicode_str
548
584
549
- def test_cancel_during_execute (self ):
550
- with self .cursor ({}) as cursor :
585
+ @pytest .mark .parametrize ("extra_params" , [
586
+ {},
587
+ {"use_sea" : True , "use_cloud_fetch" : False }
588
+ ])
589
+ def test_cancel_during_execute (self , extra_params ):
590
+ with self .cursor (extra_params ) as cursor :
551
591
552
592
def execute_really_long_query ():
553
593
cursor .execute (
@@ -578,8 +618,12 @@ def execute_really_long_query():
578
618
assert len (cursor .fetchall ()) == 3
579
619
580
620
@skipIf (pysql_has_version ("<" , "2" ), "requires pysql v2" )
581
- def test_can_execute_command_after_failure (self ):
582
- with self .cursor ({}) as cursor :
621
+ @pytest .mark .parametrize ("extra_params" , [
622
+ {},
623
+ {"use_sea" : True , "use_cloud_fetch" : False }
624
+ ])
625
+ def test_can_execute_command_after_failure (self , extra_params ):
626
+ with self .cursor (extra_params ) as cursor :
583
627
with pytest .raises (DatabaseError ):
584
628
cursor .execute ("this is a sytnax error" )
585
629
@@ -589,8 +633,12 @@ def test_can_execute_command_after_failure(self):
589
633
self .assertEqualRowValues (res , [[1 ]])
590
634
591
635
@skipIf (pysql_has_version ("<" , "2" ), "requires pysql v2" )
592
- def test_can_execute_command_after_success (self ):
593
- with self .cursor ({}) as cursor :
636
+ @pytest .mark .parametrize ("extra_params" , [
637
+ {},
638
+ {"use_sea" : True , "use_cloud_fetch" : False }
639
+ ])
640
+ def test_can_execute_command_after_success (self , extra_params ):
641
+ with self .cursor (extra_params ) as cursor :
594
642
cursor .execute ("SELECT 1;" )
595
643
cursor .execute ("SELECT 2;" )
596
644
@@ -602,8 +650,12 @@ def generate_multi_row_query(self):
602
650
return query
603
651
604
652
@skipIf (pysql_has_version ("<" , "2" ), "requires pysql v2" )
605
- def test_fetchone (self ):
606
- with self .cursor ({}) as cursor :
653
+ @pytest .mark .parametrize ("extra_params" , [
654
+ {},
655
+ {"use_sea" : True , "use_cloud_fetch" : False }
656
+ ])
657
+ def test_fetchone (self , extra_params ):
658
+ with self .cursor (extra_params ) as cursor :
607
659
query = self .generate_multi_row_query ()
608
660
cursor .execute (query )
609
661
@@ -614,8 +666,12 @@ def test_fetchone(self):
614
666
assert cursor .fetchone () == None
615
667
616
668
@skipIf (pysql_has_version ("<" , "2" ), "requires pysql v2" )
617
- def test_fetchall (self ):
618
- with self .cursor ({}) as cursor :
669
+ @pytest .mark .parametrize ("extra_params" , [
670
+ {},
671
+ {"use_sea" : True , "use_cloud_fetch" : False }
672
+ ])
673
+ def test_fetchall (self , extra_params ):
674
+ with self .cursor (extra_params ) as cursor :
619
675
query = self .generate_multi_row_query ()
620
676
cursor .execute (query )
621
677
@@ -624,26 +680,38 @@ def test_fetchall(self):
624
680
assert cursor .fetchone () == None
625
681
626
682
@skipIf (pysql_has_version ("<" , "2" ), "requires pysql v2" )
627
- def test_fetchmany_when_stride_fits (self ):
628
- with self .cursor ({}) as cursor :
683
+ @pytest .mark .parametrize ("extra_params" , [
684
+ {},
685
+ {"use_sea" : True , "use_cloud_fetch" : False }
686
+ ])
687
+ def test_fetchmany_when_stride_fits (self , extra_params ):
688
+ with self .cursor (extra_params ) as cursor :
629
689
query = "SELECT * FROM range(4)"
630
690
cursor .execute (query )
631
691
632
692
self .assertEqualRowValues (cursor .fetchmany (2 ), [[0 ], [1 ]])
633
693
self .assertEqualRowValues (cursor .fetchmany (2 ), [[2 ], [3 ]])
634
694
635
695
@skipIf (pysql_has_version ("<" , "2" ), "requires pysql v2" )
636
- def test_fetchmany_in_excess (self ):
637
- with self .cursor ({}) as cursor :
696
+ @pytest .mark .parametrize ("extra_params" , [
697
+ {},
698
+ {"use_sea" : True , "use_cloud_fetch" : False }
699
+ ])
700
+ def test_fetchmany_in_excess (self , extra_params ):
701
+ with self .cursor (extra_params ) as cursor :
638
702
query = "SELECT * FROM range(4)"
639
703
cursor .execute (query )
640
704
641
705
self .assertEqualRowValues (cursor .fetchmany (3 ), [[0 ], [1 ], [2 ]])
642
706
self .assertEqualRowValues (cursor .fetchmany (3 ), [[3 ]])
643
707
644
708
@skipIf (pysql_has_version ("<" , "2" ), "requires pysql v2" )
645
- def test_iterator_api (self ):
646
- with self .cursor ({}) as cursor :
709
+ @pytest .mark .parametrize ("extra_params" , [
710
+ {},
711
+ {"use_sea" : True , "use_cloud_fetch" : False }
712
+ ])
713
+ def test_iterator_api (self , extra_params ):
714
+ with self .cursor (extra_params ) as cursor :
647
715
query = "SELECT * FROM range(4)"
648
716
cursor .execute (query )
649
717
@@ -803,8 +871,12 @@ def test_decimal_not_returned_as_strings_arrow(self):
803
871
assert pyarrow .types .is_decimal (decimal_type )
804
872
805
873
@skipUnless (pysql_supports_arrow (), "arrow test needs arrow support" )
806
- def test_catalogs_returns_arrow_table (self ):
807
- with self .cursor () as cursor :
874
+ @pytest .mark .parametrize ("extra_params" , [
875
+ {},
876
+ {"use_sea" : True , "use_cloud_fetch" : False }
877
+ ])
878
+ def test_catalogs_returns_arrow_table (self , extra_params ):
879
+ with self .cursor (extra_params ) as cursor :
808
880
cursor .catalogs ()
809
881
results = cursor .fetchall_arrow ()
810
882
assert isinstance (results , pyarrow .Table )
0 commit comments