@@ -460,6 +460,7 @@ def test_compatible_build_version_psycopg2_libpq(self):
460
460
connect_module = mock .MagicMock ()
461
461
connect_module .__name__ = "test"
462
462
connect_module .__version__ = mock .MagicMock ()
463
+ connect_module .pq .version .side_effect = AttributeError
463
464
connect_module .__libpq_version__ = 123
464
465
connect_module .apilevel = 123
465
466
connect_module .threadsafety = 123
@@ -528,7 +529,8 @@ def test_no_build_version_where_we_dont_instrument_the_root_module(
528
529
connect_module = mock .MagicMock ()
529
530
connect_module .__name__ = "test"
530
531
connect_module .__version__ = mock .MagicMock ()
531
- connect_module .pq = mock .MagicMock ()
532
+ connect_module .pq .version .side_effect = AttributeError
533
+ connect_module .__libpq_version__ = None
532
534
connect_module .apilevel = 123
533
535
connect_module .threadsafety = 123
534
536
connect_module .paramstyle = "test"
@@ -629,8 +631,7 @@ def test_executemany_psycopg_integration_comment(self):
629
631
connect_module = mock .MagicMock ()
630
632
connect_module .__name__ = "psycopg"
631
633
connect_module .__version__ = "1.2.3"
632
- connect_module .pq = mock .MagicMock ()
633
- connect_module .pq .__build_version__ = 123
634
+ connect_module .pq .version .return_value = 123
634
635
connect_module .apilevel = 123
635
636
connect_module .threadsafety = 123
636
637
connect_module .paramstyle = "test"
@@ -663,8 +664,7 @@ def test_executemany_psycopg_integration_comment_stmt_enabled(self):
663
664
connect_module = mock .MagicMock ()
664
665
connect_module .__name__ = "psycopg"
665
666
connect_module .__version__ = "1.2.3"
666
- connect_module .pq = mock .MagicMock ()
667
- connect_module .pq .__build_version__ = 123
667
+ connect_module .pq .version .return_value = 123
668
668
connect_module .apilevel = 123
669
669
connect_module .threadsafety = 123
670
670
connect_module .paramstyle = "test"
@@ -918,8 +918,7 @@ def test_executemany_pymysql_integration_comment_stmt_enabled(self):
918
918
def test_executemany_flask_integration_comment (self ):
919
919
connect_module = mock .MagicMock ()
920
920
connect_module .__name__ = "test"
921
- connect_module .__version__ = mock .MagicMock ()
922
- connect_module .__libpq_version__ = 123
921
+ connect_module .pq .version .return_value = 123
923
922
connect_module .apilevel = 123
924
923
connect_module .threadsafety = 123
925
924
connect_module .paramstyle = "test"
0 commit comments