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

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

Issue 19921: Path.mkdir(0, True) always fails
Left Patch Set: Created 5 years, 9 months ago
Right Patch Set: Created 5 years, 9 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 | « Lib/pathlib.py ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 import collections 1 import collections
2 import io 2 import io
3 import os 3 import os
4 import errno 4 import errno
5 import pathlib 5 import pathlib
6 import pickle 6 import pickle
7 import shutil 7 import shutil
8 import socket 8 import socket
9 import stat 9 import stat
10 import sys 10 import sys
(...skipping 1481 matching lines...) Expand 10 before | Expand all | Expand 10 after
1492 self.assertTrue(p.is_dir()) 1492 self.assertTrue(p.is_dir())
1493 with self.assertRaises(OSError) as cm: 1493 with self.assertRaises(OSError) as cm:
1494 p.mkdir(parents=True) 1494 p.mkdir(parents=True)
1495 self.assertEqual(cm.exception.errno, errno.EEXIST) 1495 self.assertEqual(cm.exception.errno, errno.EEXIST)
1496 # test `mode` arg 1496 # test `mode` arg
1497 mode = stat.S_IMODE(p.stat().st_mode) # default mode 1497 mode = stat.S_IMODE(p.stat().st_mode) # default mode
1498 p = self.cls(BASE, 'newdirD', 'newdirE') 1498 p = self.cls(BASE, 'newdirD', 'newdirE')
1499 p.mkdir(0o555, parents=True) 1499 p.mkdir(0o555, parents=True)
1500 self.assertTrue(p.exists()) 1500 self.assertTrue(p.exists())
1501 self.assertTrue(p.is_dir()) 1501 self.assertTrue(p.is_dir())
1502 self.assertEqual(stat.S_IMODE(p.stat().st_mode), 0o555 & mode) 1502 if os.name != 'nt':
1503 self.assertEqual(stat.S_IMODE(p.stat().st_mode), 0o555 & mode)
1503 self.assertEqual(stat.S_IMODE(p.parent.stat().st_mode), mode) 1504 self.assertEqual(stat.S_IMODE(p.parent.stat().st_mode), mode)
1504 1505
1505 @with_symlinks 1506 @with_symlinks
1506 def test_symlink_to(self): 1507 def test_symlink_to(self):
1507 P = self.cls(BASE) 1508 P = self.cls(BASE)
1508 target = P / 'fileA' 1509 target = P / 'fileA'
1509 # Symlinking a path target 1510 # Symlinking a path target
1510 link = P / 'dirA' / 'linkAA' 1511 link = P / 'dirA' / 'linkAA'
1511 link.symlink_to(target) 1512 link.symlink_to(target)
1512 self.assertEqual(link.stat(), target.stat()) 1513 self.assertEqual(link.stat(), target.stat())
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
1727 self.assertEqual(set(p.glob("FILEa")), { P(BASE, "fileA") }) 1728 self.assertEqual(set(p.glob("FILEa")), { P(BASE, "fileA") })
1728 1729
1729 def test_rglob(self): 1730 def test_rglob(self):
1730 P = self.cls 1731 P = self.cls
1731 p = P(BASE, "dirC") 1732 p = P(BASE, "dirC")
1732 self.assertEqual(set(p.rglob("FILEd")), { P(BASE, "dirC/dirD/fileD") }) 1733 self.assertEqual(set(p.rglob("FILEd")), { P(BASE, "dirC/dirD/fileD") })
1733 1734
1734 1735
1735 if __name__ == "__main__": 1736 if __name__ == "__main__":
1736 unittest.main() 1737 unittest.main()
LEFTRIGHT

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