Lines Matching refs:dir

81     def nameCheck(self, name, dir, pre, suf):  argument
86 if dir is not None:
87 self.assertIs(type(name), str if type(dir) is str else bytes,
95 if (dir, pre, suf) == (None, None, None):
99 self.assertEqual(os.path.abspath(ndir), os.path.abspath(dir),
100 "file %r not in directory %r" % (name, dir))
312 dir = tempfile.mkdtemp()
314 with support.swap_attr(tempfile, 'tempdir', dir):
317 support.rmtree(dir)
367 def __init__(self, dir, pre, suf, bin): argument
371 output_type = tempfile._infer_return_type(dir, pre, suf)
372 (self.fd, self.name) = tempfile._mkstemp_inner(dir, pre, suf, flags, output_type)
381 def do_create(self, dir=None, pre=None, suf=None, bin=1): argument
382 output_type = tempfile._infer_return_type(dir, pre, suf)
383 if dir is None:
385 dir = tempfile.gettempdir()
387 dir = tempfile.gettempdirb()
392 file = self.mkstemped(dir, pre, suf, bin)
394 self.nameCheck(file.name, dir, pre, suf)
409 self.do_create(dir=dir_b, suf=b"").write(b"blat")
410 self.do_create(dir=dir_b, pre=b"a").write(b"blat")
411 self.do_create(dir=dir_b, suf=b"b").write(b"blat")
412 self.do_create(dir=dir_b, pre=b"a", suf=b"b").write(b"blat")
413 self.do_create(dir=dir_b, pre=b"aa", suf=b".txt").write(b"blat")
416 self.do_create(dir="", suf=b"").write(b"blat")
418 self.do_create(dir=dir_b, pre="").write(b"blat")
420 self.do_create(dir=dir_b, pre=b"", suf="").write(b"blat")
430 dir = tempfile.mkdtemp()
432 self.do_create(dir=dir).write(b"blat")
434 os.rmdir(dir)
524 dir = tempfile.mkdtemp()
525 self.assertTrue(dir.endswith('aaa'))
614 def do_create(self, dir=None, pre=None, suf=None): argument
615 output_type = tempfile._infer_return_type(dir, pre, suf)
616 if dir is None:
618 dir = tempfile.gettempdir()
620 dir = tempfile.gettempdirb()
625 (fd, name) = tempfile.mkstemp(dir=dir, prefix=pre, suffix=suf)
627 adir = os.path.abspath(dir)
632 self.nameCheck(name, dir, pre, suf)
644 self.do_create(dir=".")
650 self.do_create(dir=d, suf=b"")
651 self.do_create(dir=d, pre=b"a")
652 self.do_create(dir=d, suf=b"b")
653 self.do_create(dir=d, pre=b"a", suf=b"b")
654 self.do_create(dir=d, pre=b"aa", suf=b".txt")
655 self.do_create(dir=b".")
657 self.do_create(dir=".", pre=b"aa", suf=b".txt")
659 self.do_create(dir=b".", pre="aa", suf=b".txt")
661 self.do_create(dir=b".", pre=b"aa", suf=".txt")
666 dir = tempfile.mkdtemp()
668 self.do_create(dir=dir)
670 os.rmdir(dir)
679 def do_create(self, dir=None, pre=None, suf=None): argument
680 output_type = tempfile._infer_return_type(dir, pre, suf)
681 if dir is None:
683 dir = tempfile.gettempdir()
685 dir = tempfile.gettempdirb()
690 name = tempfile.mkdtemp(dir=dir, prefix=pre, suffix=suf)
693 self.nameCheck(name, dir, pre, suf)
710 os.rmdir(self.do_create(dir=d))
711 os.rmdir(self.do_create(dir=d, pre=b"a"))
712 os.rmdir(self.do_create(dir=d, suf=b"b"))
713 os.rmdir(self.do_create(dir=d, pre=b"a", suf=b"b"))
714 os.rmdir(self.do_create(dir=d, pre=b"aa", suf=b".txt"))
716 os.rmdir(self.do_create(dir=d, pre="aa", suf=b".txt"))
718 os.rmdir(self.do_create(dir=d, pre=b"aa", suf=".txt"))
720 os.rmdir(self.do_create(dir="", pre=b"aa", suf=b".txt"))
735 dir = tempfile.mkdtemp()
737 os.rmdir(self.do_create(dir=dir))
739 os.rmdir(dir)
745 dir = self.do_create()
747 mode = stat.S_IMODE(os.stat(dir).st_mode)
757 os.rmdir(dir)
767 dir = tempfile.mkdtemp()
768 self.assertTrue(dir.endswith('bbb'))
787 self.dir = tempfile.mkdtemp()
791 if self.dir:
792 os.rmdir(self.dir)
793 self.dir = None
800 def __init__(self, dir, pre, suf): argument
801 self.name = tempfile.mktemp(dir=dir, prefix=pre, suffix=suf)
810 file = self.mktemped(self.dir, pre, suf)
812 self.nameCheck(file.name, self.dir, pre, suf)
844 def do_create(self, dir=None, pre="", suf="", delete=True): argument
845 if dir is None:
846 dir = tempfile.gettempdir()
847 file = tempfile.NamedTemporaryFile(dir=dir, prefix=pre, suffix=suf,
850 self.nameCheck(file.name, dir, pre, suf)
899 dir = tempfile.mkdtemp()
901 f = tempfile.NamedTemporaryFile(dir=dir)
907 os.rmdir(dir)
911 dir = tempfile.mkdtemp()
914 f = tempfile.NamedTemporaryFile(dir=dir, delete=False)
923 os.rmdir(dir)
957 dir = tempfile.mkdtemp()
958 self.addCleanup(support.rmtree, dir)
960 tempfile.NamedTemporaryFile(mode='wr', dir=dir)
962 tempfile.NamedTemporaryFile(mode=2, dir=dir)
963 self.assertEqual(os.listdir(dir), [])
970 def do_create(self, max_size=0, dir=None, pre="", suf=""): argument
971 if dir is None:
972 dir = tempfile.gettempdir()
973 file = tempfile.SpooledTemporaryFile(max_size=max_size, dir=dir, prefix=pre, suffix=suf)
987 dir = tempfile.mkdtemp()
989 f = tempfile.SpooledTemporaryFile(max_size=10, dir=dir)
998 os.rmdir(dir)
1231 dir = tempfile.mkdtemp()
1232 f = tempfile.TemporaryFile(dir=dir)
1238 os.rmdir(dir)
1242 os.rmdir(dir)
1301 def do_create(self, dir=None, pre="", suf="", recurse=1): argument
1302 if dir is None:
1303 dir = tempfile.gettempdir()
1304 tmp = tempfile.TemporaryDirectory(dir=dir, prefix=pre, suffix=suf)
1305 self.nameCheck(tmp.name, dir, pre, suf)
1321 tempfile.TemporaryDirectory(dir=nonexistent)
1326 dir = tempfile.mkdtemp()
1328 d = self.do_create(dir=dir)
1335 os.rmdir(dir)
1361 dir = tempfile.mkdtemp()
1363 d = self.do_create(dir=dir)
1369 os.rmdir(dir)
1373 with self.do_create() as dir:
1394 """.format(dir=dir, mod=mod)
1405 with self.do_create() as dir:
1418 """.format(dir=dir)
1429 with self.do_create() as dir:
1430 d = self.do_create(dir=dir, recurse=3)