本文整理汇总了Python中tests.mkdtemp函数的典型用法代码示例。如果您正苦于以下问题:Python mkdtemp函数的具体用法?Python mkdtemp怎么用?Python mkdtemp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mkdtemp函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
def setUp(self):
config.init()
self.main = mkdtemp()
self.dir1 = mkdtemp(dir=self.main)
self.dir2 = mkdtemp(dir=self.main)
h, self.cover1 = mkstemp(".png", dir=self.main)
os.close(h)
pb = GdkPixbuf.Pixbuf.new(GdkPixbuf.Colorspace.RGB, True, 8, 10, 10)
pb.savev(self.cover1, "png", [], [])
h, self.cover2 = mkstemp(".png", dir=self.main)
os.close(h)
pb = GdkPixbuf.Pixbuf.new(GdkPixbuf.Colorspace.RGB, True, 8, 20, 20)
pb.savev(self.cover2, "png", [], [])
fd, self.file1 = mkstemp(".mp3", dir=self.main)
os.close(fd)
shutil.copy(os.path.join(DATA_DIR, 'silence-44-s.mp3'), self.file1)
fd, self.file2 = mkstemp(".mp3", dir=self.main)
os.close(fd)
shutil.copy(os.path.join(DATA_DIR, 'silence-44-s.mp3'), self.file2)
self.manager = CoverManager()
示例2: test_hidden_dir
def test_hidden_dir(self):
child = mkdtemp(dir=self.root, prefix=".")
fd, name = mkstemp(dir=child)
os.close(fd)
assert list(iter_paths(child)) == []
assert list(iter_paths(child, skip_hidden=False)) == [name]
assert list(iter_paths(self.root)) == []
assert list(iter_paths(self.root, skip_hidden=False)) == [name]
示例3: setUp
def setUp(self):
quodlibet.config.init()
self.ROOTS = [mkdtemp(), mkdtemp()]
self.INITIAL = self.ROOTS[0]
self.PATHS = [
os.path.join(self.ROOTS[0], "a"),
os.path.join(self.ROOTS[0], "b"),
]
for path in self.PATHS:
open(path, "wb").close()
self.fs = FileSelector(
initial=self.INITIAL, filter=(lambda s: s in self.PATHS),
folders=self.ROOTS)
self.fs.connect('changed', self._changed)
self.files = None
self.fs.rescan()
示例4: setUp
def setUp(self):
self.tempdir = mkdtemp()
self.pm = PluginManager(folders=[self.tempdir])
self.confirmed = False
self.handler = SongsMenuPluginHandler(self._confirmer, self._confirmer)
self.pm.register_handler(self.handler)
self.pm.rescan()
self.assertEquals(self.pm.plugins, [])
self.library = SongLibrary('foo')
示例5: setUp
def setUp(self):
self.tempdir = mkdtemp()
self.pm = PluginManager(folders=[self.tempdir])
self.confirmed = False
self.mock_browser = self.MockBrowser()
self.handler = PlaylistPluginHandler(self._confirmer)
self.pm.register_handler(self.handler)
self.pm.rescan()
self.assertEquals(self.pm.plugins, [])
self.library = SongLibrary("foo")
示例6: setUp
def setUp(self):
self.tempdir = mkdtemp()
self.pm = PluginManager(folders=[self.tempdir])
self.lib = SongLibrarian()
self.player = player.init_player("nullbe", self.lib)
self.handler = EventPluginHandler(
librarian=self.lib, player=self.player)
self.pm.register_handler(self.handler)
self.pm.rescan()
self.assertEquals(self.pm.plugins, [])
示例7: setUp
def setUp(self):
quodlibet.config.init()
self.lib = quodlibet.browsers.search.library = FileLibrary()
quodlibet.browsers.search.library.librarian = SongLibrarian()
for af in self.SONGS:
af.sanitize()
self.lib.add(self.SONGS)
self._dir = mkdtemp()
self.pl = FileBackedPlaylist.new(self._dir, "Foobar", self.lib)
self.pl.extend(self.SONGS)
示例8: setUp
def setUp(self):
config.init()
self.manager = CoverManager()
self.dir = mkdtemp()
self.song = self.an_album_song()
# Safety check
self.failIf(glob.glob(os.path.join(self.dir + "*.jpg")))
files = [self.full_path("12345.jpg"), self.full_path("nothing.jpg")]
for f in files:
open(f, "w").close()
示例9: test_with_dir_symlink
def test_with_dir_symlink(self):
child = mkdtemp(dir=self.root)
link = os.path.join(self.root, "foo")
os.symlink(child, link)
fd, name = mkstemp(dir=link)
os.close(fd)
assert name not in list(iter_paths(self.root))
assert list(iter_paths(link)) == list(iter_paths(child))
assert list(iter_paths(link, exclude=[link])) == []
assert list(iter_paths(child, exclude=[child])) == []
assert list(iter_paths(link, exclude=[child])) == []
示例10: setUp
def setUp(self):
config.init()
self.main = mkdtemp()
self.dir1 = mkdtemp(dir=self.main)
self.dir2 = mkdtemp(dir=self.main)
h, self.cover1 = mkstemp(".png", dir=self.main)
os.close(h)
pb = GdkPixbuf.Pixbuf.new(GdkPixbuf.Colorspace.RGB, True, 8, 10, 10)
pb.savev(self.cover1, "png", [], [])
h, self.cover2 = mkstemp(".png", dir=self.main)
os.close(h)
pb = GdkPixbuf.Pixbuf.new(GdkPixbuf.Colorspace.RGB, True, 8, 20, 20)
pb.savev(self.cover2, "png", [], [])
self.file1 = get_temp_copy(get_data_path('silence-44-s.mp3'))
self.file2 = get_temp_copy(get_data_path('silence-44-s.mp3'))
self.manager = CoverManager()
示例11: setUp
def setUp(self):
self.manager = CoverManager()
self.dir = mkdtemp()
self.song = AudioFile({
"~filename": os.path.join(self.dir, "asong.ogg"),
"album": u"Quuxly",
})
# Safety check
self.failIf(glob.glob(os.path.join(self.dir + "*.jpg")))
files = [self.full_path("12345.jpg"), self.full_path("nothing.jpg")]
for f in files:
open(f, "w").close()
示例12: reset_environment
def reset_environment(self):
config.init()
self.root_path = mkdtemp()
self.filenames = \
['cover.jpg', 'info.jpg', 'title.jpg', 'title2.jpg']
示例13: setUp
def setUp(self):
self.dir = mkdtemp()
示例14: setUp
def setUp(self):
self.temp = mkdtemp()
self.temp2 = mkdtemp()
示例15: setUp
def setUp(self):
self.p = NullPlayer()
self.dir = mkdtemp()
self.filename = os.path.join(self.dir, "foo")
self.fs = FSInterface(self.filename, self.p)