Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(117954)

Side by Side Diff: Lib/test/test_shutil.py

Issue 23670: Modifications to support iOS as a development platform
Patch Set: Created 3 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Lib/test/test_select.py ('k') | Lib/test/test_signal.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (C) 2003 Python Software Foundation 1 # Copyright (C) 2003 Python Software Foundation
2 2
3 import unittest 3 import unittest
4 import unittest.mock 4 import unittest.mock
5 import shutil 5 import shutil
6 import tempfile 6 import tempfile
7 import sys 7 import sys
8 import stat 8 import stat
9 import os 9 import os
10 import os.path 10 import os.path
(...skipping 1378 matching lines...) Expand 10 before | Expand all | Expand 10 after
1389 # copytree returns its destination path. 1389 # copytree returns its destination path.
1390 src_dir = self.mkdtemp() 1390 src_dir = self.mkdtemp()
1391 dst_dir = src_dir + "dest" 1391 dst_dir = src_dir + "dest"
1392 self.addCleanup(shutil.rmtree, dst_dir, True) 1392 self.addCleanup(shutil.rmtree, dst_dir, True)
1393 src = os.path.join(src_dir, 'foo') 1393 src = os.path.join(src_dir, 'foo')
1394 write_file(src, 'foo') 1394 write_file(src, 'foo')
1395 rv = shutil.copytree(src_dir, dst_dir) 1395 rv = shutil.copytree(src_dir, dst_dir)
1396 self.assertEqual(['foo'], os.listdir(rv)) 1396 self.assertEqual(['foo'], os.listdir(rv))
1397 1397
1398 1398
1399 @unittest.skipIf(sys.platform == 'ios', "iOS doesn't support other executables." )
1399 class TestWhich(unittest.TestCase): 1400 class TestWhich(unittest.TestCase):
1400 1401
1401 def setUp(self): 1402 def setUp(self):
1402 self.temp_dir = tempfile.mkdtemp(prefix="Tmp") 1403 self.temp_dir = tempfile.mkdtemp(prefix="Tmp")
1403 self.addCleanup(shutil.rmtree, self.temp_dir, True) 1404 self.addCleanup(shutil.rmtree, self.temp_dir, True)
1404 # Give the temp_file an ".exe" suffix for all. 1405 # Give the temp_file an ".exe" suffix for all.
1405 # It's needed on Windows and not harmful on other platforms. 1406 # It's needed on Windows and not harmful on other platforms.
1406 self.temp_file = tempfile.NamedTemporaryFile(dir=self.temp_dir, 1407 self.temp_file = tempfile.NamedTemporaryFile(dir=self.temp_dir,
1407 prefix="Tmp", 1408 prefix="Tmp",
1408 suffix=".Exe") 1409 suffix=".Exe")
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
1830 env['COLUMNS'] = '777' 1831 env['COLUMNS'] = '777'
1831 size = shutil.get_terminal_size() 1832 size = shutil.get_terminal_size()
1832 self.assertEqual(size.columns, 777) 1833 self.assertEqual(size.columns, 777)
1833 1834
1834 with support.EnvironmentVarGuard() as env: 1835 with support.EnvironmentVarGuard() as env:
1835 env['LINES'] = '888' 1836 env['LINES'] = '888'
1836 size = shutil.get_terminal_size() 1837 size = shutil.get_terminal_size()
1837 self.assertEqual(size.lines, 888) 1838 self.assertEqual(size.lines, 888)
1838 1839
1839 @unittest.skipUnless(os.isatty(sys.__stdout__.fileno()), "not on tty") 1840 @unittest.skipUnless(os.isatty(sys.__stdout__.fileno()), "not on tty")
1841 @unittest.skipUnless(hasattr(subprocess, 'Popen'), "test requires subprocess .Popen()")
1840 def test_stty_match(self): 1842 def test_stty_match(self):
1841 """Check if stty returns the same results ignoring env 1843 """Check if stty returns the same results ignoring env
1842 1844
1843 This test will fail if stdin and stdout are connected to 1845 This test will fail if stdin and stdout are connected to
1844 different terminals with different sizes. Nevertheless, such 1846 different terminals with different sizes. Nevertheless, such
1845 situations should be pretty rare. 1847 situations should be pretty rare.
1846 """ 1848 """
1847 try: 1849 try:
1848 size = subprocess.check_output(['stty', 'size']).decode().split() 1850 size = subprocess.check_output(['stty', 'size']).decode().split()
1849 except (FileNotFoundError, subprocess.CalledProcessError): 1851 except (FileNotFoundError, subprocess.CalledProcessError):
(...skipping 21 matching lines...) Expand all
1871 'register_unpack_format', 'unregister_unpack_format', 1873 'register_unpack_format', 'unregister_unpack_format',
1872 'unpack_archive', 'ignore_patterns', 'chown', 'which', 1874 'unpack_archive', 'ignore_patterns', 'chown', 'which',
1873 'get_terminal_size', 'SameFileError'] 1875 'get_terminal_size', 'SameFileError']
1874 if hasattr(os, 'statvfs') or os.name == 'nt': 1876 if hasattr(os, 'statvfs') or os.name == 'nt':
1875 target_api.append('disk_usage') 1877 target_api.append('disk_usage')
1876 self.assertEqual(set(shutil.__all__), set(target_api)) 1878 self.assertEqual(set(shutil.__all__), set(target_api))
1877 1879
1878 1880
1879 if __name__ == '__main__': 1881 if __name__ == '__main__':
1880 unittest.main() 1882 unittest.main()
OLDNEW
« no previous file with comments | « Lib/test/test_select.py ('k') | Lib/test/test_signal.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+