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

Delta Between Two Patch Sets: Lib/test/test_os.py

Issue 26826: Expose new copy_file_range() syscal in os module and use it to improve shutils.copy()
Left Patch Set: Created 3 years, 7 months ago
Right Patch Set: Created 3 years, 7 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « Doc/library/os.rst ('k') | Modules/posixmodule.c » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 # As a test suite for the os module, this is woefully inadequate, but this 1 # As a test suite for the os module, this is woefully inadequate, but this
2 # does add tests for a few functions which have been determined to be more 2 # does add tests for a few functions which have been determined to be more
3 # portable than they had been thought to be. 3 # portable than they had been thought to be.
4 4
5 import asynchat 5 import asynchat
6 import asyncore 6 import asyncore
7 import codecs 7 import codecs
8 import contextlib 8 import contextlib
9 import decimal 9 import decimal
10 import errno 10 import errno
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 TESTFN2 = support.TESTFN + ".3" 249 TESTFN2 = support.TESTFN + ".3"
250 data = b'0123456789' 250 data = b'0123456789'
251 251
252 create_file(support.TESTFN, data) 252 create_file(support.TESTFN, data)
253 self.addCleanup(support.unlink, support.TESTFN) 253 self.addCleanup(support.unlink, support.TESTFN)
254 254
255 in_file = open(support.TESTFN, 'rb') 255 in_file = open(support.TESTFN, 'rb')
256 self.addCleanup(in_file.close) 256 self.addCleanup(in_file.close)
257 in_fd = in_file.fileno() 257 in_fd = in_file.fileno()
258 258
259 out_file = open (TESTFN2, 'w+b') 259 out_file = open(TESTFN2, 'w+b')
Martin Panter 2016/07/10 07:26:14 Extra space in function call not needed
260 self.addCleanup(support.unlink, TESTFN2) 260 self.addCleanup(support.unlink, TESTFN2)
261 self.addCleanup(out_file.close) 261 self.addCleanup(out_file.close)
262 out_fd = out_file.fileno() 262 out_fd = out_file.fileno()
263 263
264 try: 264 try:
265 i = os.copy_file_range(in_fd, out_fd, 5); 265 i = os.copy_file_range(in_fd, out_fd, 5)
Martin Panter 2016/07/10 07:26:14 Extra semicolon not needed
266 except OSError as e: 266 except OSError as e:
267 # this is needed in case Python was compiled 267 # this is needed in case Python was compiled
268 # in a system with the syscall 268 # in a system with the syscall
269 # but the system in which is run does not 269 # but the system in which is run does not
270 # which is kernel dependant, for the moment 270 # which is kernel dependant, for the moment
271 if e.errno != errno.ENOSYS: 271 if e.errno != errno.ENOSYS:
272 raise 272 raise
273 self.skipTest(e) 273 self.skipTest(e)
274 else: 274 else:
275 self.assertIn(i, range(0, 6)); 275 self.assertIn(i, range(0, 6));
(...skipping 2943 matching lines...) Expand 10 before | Expand all | Expand 10 after
3219 for o in int, type, os, vapor(): 3219 for o in int, type, os, vapor():
3220 self.assertRaises(TypeError, os.fspath, o) 3220 self.assertRaises(TypeError, os.fspath, o)
3221 3221
3222 def test_argument_required(self): 3222 def test_argument_required(self):
3223 with self.assertRaises(TypeError): 3223 with self.assertRaises(TypeError):
3224 os.fspath() 3224 os.fspath()
3225 3225
3226 3226
3227 if __name__ == "__main__": 3227 if __name__ == "__main__":
3228 unittest.main() 3228 unittest.main()
LEFTRIGHT

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