@@ -460,6 +460,7 @@ def test_compatible_build_version_psycopg2_libpq(self):
460460 connect_module = mock .MagicMock ()
461461 connect_module .__name__ = "test"
462462 connect_module .__version__ = mock .MagicMock ()
463+ connect_module .pq .version .side_effect = AttributeError
463464 connect_module .__libpq_version__ = 123
464465 connect_module .apilevel = 123
465466 connect_module .threadsafety = 123
@@ -528,7 +529,8 @@ def test_no_build_version_where_we_dont_instrument_the_root_module(
528529 connect_module = mock .MagicMock ()
529530 connect_module .__name__ = "test"
530531 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
532534 connect_module .apilevel = 123
533535 connect_module .threadsafety = 123
534536 connect_module .paramstyle = "test"
@@ -629,8 +631,7 @@ def test_executemany_psycopg_integration_comment(self):
629631 connect_module = mock .MagicMock ()
630632 connect_module .__name__ = "psycopg"
631633 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
634635 connect_module .apilevel = 123
635636 connect_module .threadsafety = 123
636637 connect_module .paramstyle = "test"
@@ -663,8 +664,7 @@ def test_executemany_psycopg_integration_comment_stmt_enabled(self):
663664 connect_module = mock .MagicMock ()
664665 connect_module .__name__ = "psycopg"
665666 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
668668 connect_module .apilevel = 123
669669 connect_module .threadsafety = 123
670670 connect_module .paramstyle = "test"
@@ -918,8 +918,7 @@ def test_executemany_pymysql_integration_comment_stmt_enabled(self):
918918 def test_executemany_flask_integration_comment (self ):
919919 connect_module = mock .MagicMock ()
920920 connect_module .__name__ = "test"
921- connect_module .__version__ = mock .MagicMock ()
922- connect_module .__libpq_version__ = 123
921+ connect_module .pq .version .return_value = 123
923922 connect_module .apilevel = 123
924923 connect_module .threadsafety = 123
925924 connect_module .paramstyle = "test"
0 commit comments