File tree Expand file tree Collapse file tree 1 file changed +0
-29
lines changed
Expand file tree Collapse file tree 1 file changed +0
-29
lines changed Original file line number Diff line number Diff line change @@ -971,32 +971,3 @@ def test_initial_namespace(self):
971971 assert cursor .fetchone ()[0 ] == self .arguments ["catalog" ]
972972 cursor .execute ("select current_database()" )
973973 assert cursor .fetchone ()[0 ] == table_name
974-
975-
976- class TestContextManagerInterrupts (PySQLPytestTestCase ):
977- def test_connection_context_manager_handles_keyboard_interrupt (self ):
978- # This test ensures that a KeyboardInterrupt inside a connection context propagates and closes the connection
979- conn = None
980- try :
981- with pytest .raises (KeyboardInterrupt ):
982- with self .connection () as c :
983- conn = c
984- raise KeyboardInterrupt ("Simulated interrupt" )
985- finally :
986- if conn is not None :
987- assert not conn .open , "Connection should be closed after KeyboardInterrupt"
988-
989- def test_cursor_context_manager_handles_keyboard_interrupt (self ):
990- # This test ensures that a KeyboardInterrupt inside a cursor context propagates and closes the cursor
991- conn = None
992- cursor = None
993- try :
994- with self .connection () as c :
995- conn = c
996- with pytest .raises (KeyboardInterrupt ):
997- with conn .cursor () as cur :
998- cursor = cur
999- raise KeyboardInterrupt ("Simulated interrupt" )
1000- finally :
1001- if cursor is not None :
1002- assert not cursor .open , "Cursor should be closed after KeyboardInterrupt"
You can’t perform that action at this time.
0 commit comments