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

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 shutil.rmtree(join('newdirB'))
AntoinePitrou 2013/12/07 22:21:59 Rather than calling rmtree() here, better create a
1498 p.mkdir(0o444, parents=True)
1499 self.assertTrue(p.exists())
1500 self.assertTrue(p.is_dir())
1501 self.assertEqual(stat.S_IMODE(p.stat().st_mode), 0o444)
AntoinePitrou 2013/12/07 22:21:59 Under Windows, a directory will be either 0o555 or
1502 self.assertEqual(stat.S_IMODE(p.parent.stat().st_mode), 0o775)
AntoinePitrou 2013/12/07 22:21:59 Er... 0o775 is your personal umask, right?
1497 1503
1498 @with_symlinks 1504 @with_symlinks
1499 def test_symlink_to(self): 1505 def test_symlink_to(self):
1500 P = self.cls(BASE) 1506 P = self.cls(BASE)
1501 target = P / 'fileA' 1507 target = P / 'fileA'
1502 # Symlinking a path target 1508 # Symlinking a path target
1503 link = P / 'dirA' / 'linkAA' 1509 link = P / 'dirA' / 'linkAA'
1504 link.symlink_to(target) 1510 link.symlink_to(target)
1505 self.assertEqual(link.stat(), target.stat()) 1511 self.assertEqual(link.stat(), target.stat())
1506 self.assertNotEqual(link.lstat(), target.stat()) 1512 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") }) 1726 self.assertEqual(set(p.glob("FILEa")), { P(BASE, "fileA") })
1721 1727
1722 def test_rglob(self): 1728 def test_rglob(self):
1723 P = self.cls 1729 P = self.cls
1724 p = P(BASE, "dirC") 1730 p = P(BASE, "dirC")
1725 self.assertEqual(set(p.rglob("FILEd")), { P(BASE, "dirC/dirD/fileD") }) 1731 self.assertEqual(set(p.rglob("FILEd")), { P(BASE, "dirC/dirD/fileD") })
1726 1732
1727 1733
1728 if __name__ == "__main__": 1734 if __name__ == "__main__":
1729 unittest.main() 1735 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+