mirror of
				https://github.com/python/cpython.git
				synced 2025-10-28 20:25:04 +00:00 
			
		
		
		
	Issue #15441: Skip test_nonascii_abspath() of test_genericpath on Windows
if the bytes filenames cannot be encoded from the file system (ANSI) code page
This commit is contained in:
		
							parent
							
								
									53386d8f20
								
							
						
					
					
						commit
						7c7ea62e6c
					
				
					 1 changed files with 11 additions and 3 deletions
				
			
		|  | @ -299,8 +299,7 @@ def test_abspath_issue3426(self): | |||
| 
 | ||||
|         unicwd = '\xe7w\xf0' | ||||
|         try: | ||||
|             fsencoding = support.TESTFN_ENCODING or "ascii" | ||||
|             unicwd.encode(fsencoding) | ||||
|             os.fsencode(unicwd) | ||||
|         except (AttributeError, UnicodeEncodeError): | ||||
|             # FS encoding is probably ASCII | ||||
|             pass | ||||
|  | @ -312,10 +311,19 @@ def test_abspath_issue3426(self): | |||
|     @unittest.skipIf(sys.platform == 'darwin', | ||||
|         "Mac OS X denies the creation of a directory with an invalid utf8 name") | ||||
|     def test_nonascii_abspath(self): | ||||
|         name = b'\xe7w\xf0' | ||||
|         if sys.platform == 'win32': | ||||
|             try: | ||||
|                 os.fsdecode(name) | ||||
|             except UnicodeDecodeError: | ||||
|                 self.skipTest("the filename %a is not decodable " | ||||
|                               "from the ANSI code page %s" | ||||
|                               % (name, sys.getfilesystemencoding())) | ||||
| 
 | ||||
|         # Test non-ASCII, non-UTF8 bytes in the path. | ||||
|         with warnings.catch_warnings(): | ||||
|             warnings.simplefilter("ignore", DeprecationWarning) | ||||
|             with support.temp_cwd(b'\xe7w\xf0'): | ||||
|             with support.temp_cwd(name): | ||||
|                 self.test_abspath() | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Victor Stinner
						Victor Stinner