mirror of
				https://github.com/psycopg/psycopg2.git
				synced 2025-11-04 01:37:31 +03:00 
			
		
		
		
	Fixed tests on Py 2.5
This commit is contained in:
		
							parent
							
								
									9d4e3a06b7
								
							
						
					
					
						commit
						f4b57822b0
					
				| 
						 | 
					@ -22,6 +22,8 @@
 | 
				
			||||||
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
 | 
					# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
 | 
				
			||||||
# License for more details.
 | 
					# License for more details.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					from __future__ import with_statement
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import time
 | 
					import time
 | 
				
			||||||
import pickle
 | 
					import pickle
 | 
				
			||||||
import psycopg2
 | 
					import psycopg2
 | 
				
			||||||
| 
						 | 
					@ -528,12 +530,13 @@ class CursorTests(ConnectingTestCase):
 | 
				
			||||||
            with control_conn.cursor() as cur:
 | 
					            with control_conn.cursor() as cur:
 | 
				
			||||||
                cur.execute('select pg_terminate_backend(%s)', (pid1,))
 | 
					                cur.execute('select pg_terminate_backend(%s)', (pid1,))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            time.sleep(0.001)
 | 
					            def f():
 | 
				
			||||||
            with self.assertRaises(psycopg2.OperationalError):
 | 
					 | 
				
			||||||
                with victim_conn.cursor() as cur:
 | 
					                with victim_conn.cursor() as cur:
 | 
				
			||||||
                    cur.execute('select 1')
 | 
					                    cur.execute('select 1')
 | 
				
			||||||
                    wait_func(victim_conn)
 | 
					                    wait_func(victim_conn)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            time.sleep(0.001)
 | 
				
			||||||
 | 
					            self.assertRaises(psycopg2.OperationalError, f)
 | 
				
			||||||
            self.assertEqual(victim_conn.closed, 2)
 | 
					            self.assertEqual(victim_conn.closed, 2)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user