mirror of
				https://github.com/psycopg/psycopg2.git
				synced 2025-11-04 01:37:31 +03:00 
			
		
		
		
	Skip test if uuid not available on Python.
This commit is contained in:
		
							parent
							
								
									bb44bcd5b5
								
							
						
					
					
						commit
						5a025825cc
					
				| 
						 | 
					@ -29,6 +29,11 @@ import tests
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def skip_if_no_uuid(f):
 | 
					def skip_if_no_uuid(f):
 | 
				
			||||||
    def skip_if_no_uuid_(self):
 | 
					    def skip_if_no_uuid_(self):
 | 
				
			||||||
 | 
					        try:
 | 
				
			||||||
 | 
					            import uuid
 | 
				
			||||||
 | 
					        except ImportError:
 | 
				
			||||||
 | 
					            return self.skipTest("uuid not available in this Python version")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
            cur = self.conn.cursor()
 | 
					            cur = self.conn.cursor()
 | 
				
			||||||
            cur.execute("select typname from pg_type where typname = 'uuid'")
 | 
					            cur.execute("select typname from pg_type where typname = 'uuid'")
 | 
				
			||||||
| 
						 | 
					@ -39,7 +44,7 @@ def skip_if_no_uuid(f):
 | 
				
			||||||
        if has:
 | 
					        if has:
 | 
				
			||||||
            return f(self)
 | 
					            return f(self)
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            return self.skipTest("uuid type not available")
 | 
					            return self.skipTest("uuid type not available on the server")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return skip_if_no_uuid_
 | 
					    return skip_if_no_uuid_
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user