mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	bpo-29185: Fix test_distutils failures on Android (GH-4438)
				
					
				
			* Run gzip with separate command line options (Android understands '-f9' as the name of a file). * Creation of a hard link is controled by SELinux on Android.
This commit is contained in:
		
							parent
							
								
									9001d1f438
								
							
						
					
					
						commit
						d34d8fc24f
					
				
					 2 changed files with 10 additions and 2 deletions
				
			
		|  | @ -162,7 +162,7 @@ def test_tarfile_vs_tar(self): | ||||||
|         # now create another tarball using `tar` |         # now create another tarball using `tar` | ||||||
|         tarball2 = os.path.join(tmpdir, 'archive2.tar.gz') |         tarball2 = os.path.join(tmpdir, 'archive2.tar.gz') | ||||||
|         tar_cmd = ['tar', '-cf', 'archive2.tar', 'dist'] |         tar_cmd = ['tar', '-cf', 'archive2.tar', 'dist'] | ||||||
|         gzip_cmd = ['gzip', '-f9', 'archive2.tar'] |         gzip_cmd = ['gzip', '-f', '-9', 'archive2.tar'] | ||||||
|         old_dir = os.getcwd() |         old_dir = os.getcwd() | ||||||
|         os.chdir(tmpdir) |         os.chdir(tmpdir) | ||||||
|         try: |         try: | ||||||
|  |  | ||||||
|  | @ -8,7 +8,7 @@ | ||||||
| from distutils import log | from distutils import log | ||||||
| from distutils.tests import support | from distutils.tests import support | ||||||
| from distutils.errors import DistutilsFileError | from distutils.errors import DistutilsFileError | ||||||
| from test.support import run_unittest | from test.support import run_unittest, unlink | ||||||
| 
 | 
 | ||||||
| class FileUtilTestCase(support.TempdirManager, unittest.TestCase): | class FileUtilTestCase(support.TempdirManager, unittest.TestCase): | ||||||
| 
 | 
 | ||||||
|  | @ -80,6 +80,14 @@ def test_move_file_exception_unpacking_unlink(self): | ||||||
|     def test_copy_file_hard_link(self): |     def test_copy_file_hard_link(self): | ||||||
|         with open(self.source, 'w') as f: |         with open(self.source, 'w') as f: | ||||||
|             f.write('some content') |             f.write('some content') | ||||||
|  |         # Check first that copy_file() will not fall back on copying the file | ||||||
|  |         # instead of creating the hard link. | ||||||
|  |         try: | ||||||
|  |             os.link(self.source, self.target) | ||||||
|  |         except OSError as e: | ||||||
|  |             self.skipTest('os.link: %s' % e) | ||||||
|  |         else: | ||||||
|  |             unlink(self.target) | ||||||
|         st = os.stat(self.source) |         st = os.stat(self.source) | ||||||
|         copy_file(self.source, self.target, link='hard') |         copy_file(self.source, self.target, link='hard') | ||||||
|         st2 = os.stat(self.source) |         st2 = os.stat(self.source) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 xdegaye
						xdegaye