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

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

Issue 19921: Path.mkdir(0, True) always fails
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:
View unified diff | Download patch
« no previous file with comments | « Lib/pathlib.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1475 matching lines...) Expand 10 before | Expand all | Expand 10 after
1486 self.assertFalse(p.exists()) 1486 self.assertFalse(p.exists())
1487 with self.assertRaises(OSError) as cm: 1487 with self.assertRaises(OSError) as cm:
1488 p.mkdir() 1488 p.mkdir()
1489 self.assertEqual(cm.exception.errno, errno.ENOENT) 1489 self.assertEqual(cm.exception.errno, errno.ENOENT)
1490 p.mkdir(parents=True) 1490 p.mkdir(parents=True)
1491 self.assertTrue(p.exists()) 1491 self.assertTrue(p.exists())
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 # XXX test `mode` arg 1496 # test `mode` arg
1497 mode = stat.S_IMODE(p.stat().st_mode) # default mode
1498 p = self.cls(BASE, 'newdirD', 'newdirE')
1499 p.mkdir(0o555, parents=True)
1500 self.assertTrue(p.exists())
1501 self.assertTrue(p.is_dir())
1502 if os.name != 'nt':
1503 self.assertEqual(stat.S_IMODE(p.stat().st_mode), 0o555 & mode)
1504 self.assertEqual(stat.S_IMODE(p.parent.stat().st_mode), mode)
1497 1505
1498 @with_symlinks 1506 @with_symlinks
1499 def test_symlink_to(self): 1507 def test_symlink_to(self):
1500 P = self.cls(BASE) 1508 P = self.cls(BASE)
1501 target = P / 'fileA' 1509 target = P / 'fileA'
1502 # Symlinking a path target 1510 # Symlinking a path target
1503 link = P / 'dirA' / 'linkAA' 1511 link = P / 'dirA' / 'linkAA'
1504 link.symlink_to(target) 1512 link.symlink_to(target)
1505 self.assertEqual(link.stat(), target.stat()) 1513 self.assertEqual(link.stat(), target.stat())
1506 self.assertNotEqual(link.lstat(), target.stat()) 1514 self.assertNotEqual(link.lstat(), target.stat())
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
1720 self.assertEqual(set(p.glob("FILEa")), { P(BASE, "fileA") }) 1728 self.assertEqual(set(p.glob("FILEa")), { P(BASE, "fileA") })
1721 1729
1722 def test_rglob(self): 1730 def test_rglob(self):
1723 P = self.cls 1731 P = self.cls
1724 p = P(BASE, "dirC") 1732 p = P(BASE, "dirC")
1725 self.assertEqual(set(p.rglob("FILEd")), { P(BASE, "dirC/dirD/fileD") }) 1733 self.assertEqual(set(p.rglob("FILEd")), { P(BASE, "dirC/dirD/fileD") })
1726 1734
1727 1735
1728 if __name__ == "__main__": 1736 if __name__ == "__main__":
1729 unittest.main() 1737 unittest.main()
OLDNEW
« no previous file with comments | « Lib/pathlib.py ('k') | no next file » | no next file with comments »

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