Lines Matching +full:path +full:- +full:exists
28 # number of files that can be opened at one time (see ulimit -n)
64 self.assertIs(str, tempfile._infer_return_type(pathlib.Path('/')))
67 class Path: class
68 def __init__(self, path): argument
69 self.path = path
72 return self.path
74 self.assertIs(str, tempfile._infer_return_type(Path('/')))
75 self.assertIs(bytes, tempfile._infer_return_type(Path(b'/')))
76 self.assertIs(str, tempfile._infer_return_type('', Path('')))
77 self.assertIs(bytes, tempfile._infer_return_type(b'', Path(b'')))
78 self.assertIs(bytes, tempfile._infer_return_type(None, Path(b'')))
79 self.assertIs(str, tempfile._infer_return_type(None, Path('')))
82 tempfile._infer_return_type('', Path(b''))
84 tempfile._infer_return_type(b'', Path(''))
90 str_check = re.compile(r"^[a-z0-9_-]{8}$")
91 b_check = re.compile(br"^[a-z0-9_-]{8}$")
99 (ndir, nbase) = os.path.split(name)
101 nsuf = nbase[len(nbase)-len(suf):]
121 self.assertEqual(os.path.abspath(ndir), os.path.abspath(dir),
128 nbase = nbase[len(pre):len(nbase)-len(suf)]
173 # _RandomNameSequence returns a eight-character string
211 # bypass the normal exit handlers- leave those to
248 env[envname] = os.path.abspath(envname)
264 # Not practical to try to verify the presence of OS-specific
346 self.skipTest("can't set the directory read-only")
355 tempdir = os.path.join(tempfile.tempdir, 'nonexistent')
362 tempdir = os.path.join(tempfile.tempdir, 'file')
440 # _mkstemp_inner can create files in a user-selected directory
444 self.do_create(dir=pathlib.Path(dir)).write(b"blat")
485 tester = os.path.join(os.path.dirname(os.path.abspath(me)),
488 # On Windows a spawn* /path/ with embedded spaces shouldn't be quoted,
499 "child process caught fatal signal %d" % -retval)
522 # the chosen name already exists
535 # the chosen name already exists
570 p = os.path.join(d, p)
582 # gettempdir returns a directory which exists
585 self.assertTrue(os.path.isabs(d) or d == os.curdir,
586 "%r is not an absolute path" % d)
587 self.assertTrue(os.path.isdir(d),
611 # even on a case-insensitive file system
612 case_sensitive_tempdir = tempfile.mkdtemp("-Temp")
639 (ndir, nbase) = os.path.split(name)
640 adir = os.path.abspath(dir)
678 # mkstemp can create directories in a user-selected directory
682 self.do_create(dir=pathlib.Path(dir))
690 fd, path = tempfile.mkstemp()
692 os.unlink(path)
693 self.assertIsInstance(path, str)
698 fd, path = tempfile.mkstemp()
700 os.unlink(path)
701 self.assertIsInstance(path, bytes)
702 fd, path = tempfile.mkstemp(suffix='.txt')
704 os.unlink(path)
705 self.assertIsInstance(path, str)
706 fd, path = tempfile.mkstemp(prefix='test-temp-')
708 os.unlink(path)
709 self.assertIsInstance(path, str)
710 fd, path = tempfile.mkstemp(dir=tempfile.gettempdir())
712 os.unlink(path)
713 self.assertIsInstance(path, str)
779 # mkdtemp can create directories in a user-selected directory
783 os.rmdir(self.do_create(dir=pathlib.Path(dir)))
834 # the chosen name already exists
845 # the chosen name already exists
857 path = tempfile.mkdtemp()
858 os.rmdir(path)
859 self.assertIsInstance(path, str)
864 path = tempfile.mkdtemp()
865 os.rmdir(path)
866 self.assertIsInstance(path, bytes)
867 path = tempfile.mkdtemp(suffix='-dir')
868 os.rmdir(path)
869 self.assertIsInstance(path, str)
870 path = tempfile.mkdtemp(prefix='test-mkdtemp-')
871 os.rmdir(path)
872 self.assertIsInstance(path, str)
873 path = tempfile.mkdtemp(dir=tempfile.gettempdir())
874 os.rmdir(path)
875 self.assertIsInstance(path, str)
990 self.assertEqual(i, len(lines) - 1)
995 self.assertTrue(os.path.exists(f.name),
1005 self.assertFalse(os.path.exists(f.name),
1006 "NamedTemporaryFile %s exists after close" % f.name)
1011 # Tests that delete-on-close can be disabled
1019 self.assertTrue(os.path.exists(f.name),
1037 self.assertTrue(os.path.exists(f.name))
1038 self.assertFalse(os.path.exists(f.name))
1057 tempfile.NamedTemporaryFile('w', encoding='bad-encoding', dir=dir)
1109 missing_attrs = iobase_attrs - spooledtempfile_attrs
1127 self.assertFalse(os.path.exists(filename),
1128 "SpooledTemporaryFile %s exists after close" % filename)
1151 self.assertTrue(os.path.exists(name))
1155 os.path.exists(name),
1156 "Rolled SpooledTemporaryFile (name=%s) exists after delete" % name
1276 encoding="utf-8")
1287 self.assertEqual(f.encoding, "utf-8")
1301 self.assertEqual(f.encoding, "utf-8")
1306 newline='', encoding='utf-8',
1315 self.assertEqual(f.encoding, "utf-8")
1327 self.assertEqual(f.encoding, 'utf-8')
1404 # No point in testing the name params - the file has no name.
1442 roundtrip("\u039B", "w+", encoding="utf-16")
1458 tempfile.TemporaryFile('w', encoding='bad-encoding', dir=dir)
1506 def do_create2(self, path, recurse=1, dirs=1, files=1): argument
1510 name = os.path.join(path, "dir%d" % i)
1512 self.do_create2(name, recurse-1, dirs, files)
1514 with open(os.path.join(path, "test%d.txt" % i), "wb") as f:
1532 self.assertTrue(os.path.exists(d.name),
1535 self.assertFalse(os.path.exists(d.name),
1536 "TemporaryDirectory %s exists after cleanup" % d.name)
1545 temp_path = pathlib.Path(temp_dir.name)
1546 self.assertTrue(temp_path.exists(),
1556 temp_path.exists(),
1561 temp_path.exists(),
1562 f"TemporaryDirectory {temp_path!s} exists after cleanup")
1570 # Symlink d1/foo -> d2
1571 os.symlink(d2.name, os.path.join(d1.name, "foo"))
1576 self.assertFalse(os.path.exists(d1.name),
1577 "TemporaryDirectory %s exists after cleanup" % d1.name)
1578 self.assertTrue(os.path.exists(d2.name),
1589 file1 = os.path.join(d2, 'file1')
1591 dir1 = os.path.join(d2, 'dir1')
1598 symlink = os.path.join(d1.name, 'symlink')
1611 self.assertFalse(os.path.exists(d1.name))
1642 file1 = os.path.join(d2, 'file1')
1644 dir1 = os.path.join(d2, 'dir1')
1648 symlink = os.path.join(d1.name, 'symlink')
1661 self.assertFalse(os.path.exists(d1.name))
1690 self.assertFalse(os.path.exists(name),
1691 "TemporaryDirectory %s exists after __del__" % name)
1701 temp_path = pathlib.Path(temp_dir.name)
1702 self.assertTrue(temp_path.exists(),
1712 temp_path.exists(),
1731 tmp2 = os.path.join(tmp.name, 'test_dir')
1733 with open(os.path.join(tmp2, "test0.txt"), "w") as f:
1740 rc, out, err = script_helper.assert_python_ok("-c", code)
1742 self.assertFalse(os.path.exists(tmp_name),
1743 "TemporaryDirectory %s exists after cleanup" % tmp_name)
1744 err = err.decode('utf-8', 'backslashreplace')
1761 temp_dir_2 = pathlib.Path(temp_dir.name) / "test_dir"
1770 __, out, err = script_helper.assert_python_ok("-c", code)
1771 temp_path = pathlib.Path(out.decode().strip())
1777 temp_path.exists(),
1780 err = err.decode('utf-8', 'backslashreplace')
1801 rc, out, err = script_helper.assert_python_ok("-c", code)
1803 self.assertFalse(os.path.exists(tmp_name),
1804 "TemporaryDirectory %s exists after cleanup" % tmp_name)
1805 err = err.decode('utf-8', 'backslashreplace')
1822 self.assertFalse(os.path.exists(name),
1823 "TemporaryDirectory %s exists after __del__" % name)
1826 # Can be cleaned-up many times without error
1836 self.assertTrue(os.path.exists(name))
1838 self.assertFalse(os.path.exists(name))
1849 os.chmod(os.path.join(root, name), mode)
1852 self.assertFalse(os.path.exists(d.name))
1880 os.chflags(os.path.join(root, name), flags)
1883 self.assertFalse(os.path.exists(d.name))