mirror of
				https://github.com/psycopg/psycopg2.git
				synced 2025-10-31 15:57:31 +03:00 
			
		
		
		
	Use unittest 'skip' feature to skip mxDateTimeTests
Rather than deleting, the class, use the skip feature. Provides a more informative message during test output. Never skip DatetimeTests as all supported Python environments have the datetime module builtin.
This commit is contained in:
		
							parent
							
								
									d411dc3a73
								
							
						
					
					
						commit
						ad4c6a4673
					
				|  | @ -447,11 +447,10 @@ class DatetimeTests(ConnectingTestCase, CommonDatetimeTestsMixin): | ||||||
|         self.assertRaises(psycopg2.NotSupportedError, cur.fetchone) |         self.assertRaises(psycopg2.NotSupportedError, cur.fetchone) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| # Only run the datetime tests if psycopg was compiled with support. | @unittest.skipUnless( | ||||||
| if not hasattr(psycopg2.extensions, 'PYDATETIME'): |     hasattr(psycopg2._psycopg, 'MXDATETIME'), | ||||||
|     del DatetimeTests |     'Requires mx.DateTime support' | ||||||
| 
 | ) | ||||||
| 
 |  | ||||||
| class mxDateTimeTests(ConnectingTestCase, CommonDatetimeTestsMixin): | class mxDateTimeTests(ConnectingTestCase, CommonDatetimeTestsMixin): | ||||||
|     """Tests for the mx.DateTime based date handling in psycopg2.""" |     """Tests for the mx.DateTime based date handling in psycopg2.""" | ||||||
| 
 | 
 | ||||||
|  | @ -626,14 +625,6 @@ class mxDateTimeTests(ConnectingTestCase, CommonDatetimeTestsMixin): | ||||||
|         self._test_type_roundtrip_array(DateTimeDeltaFrom(seconds=30)) |         self._test_type_roundtrip_array(DateTimeDeltaFrom(seconds=30)) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| # Only run the mx.DateTime tests if psycopg was compiled with support. |  | ||||||
| try: |  | ||||||
|     if not hasattr(psycopg2._psycopg, 'MXDATETIME'): |  | ||||||
|         del mxDateTimeTests |  | ||||||
| except AttributeError: |  | ||||||
|     del mxDateTimeTests |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| class FromTicksTestCase(unittest.TestCase): | class FromTicksTestCase(unittest.TestCase): | ||||||
|     # bug "TimestampFromTicks() throws ValueError (2-2.0.14)" |     # bug "TimestampFromTicks() throws ValueError (2-2.0.14)" | ||||||
|     # reported by Jozsef Szalay on 2010-05-06 |     # reported by Jozsef Szalay on 2010-05-06 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user