本文整理汇总了Python中tests.mkdtemp函数的典型用法代码示例。如果您正苦于以下问题:Python mkdtemp函数的具体用法?Python mkdtemp怎么用?Python mkdtemp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mkdtemp函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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()
开发者ID:bp0,项目名称:quodlibet,代码行数:27,代码来源:test_plugins_cover.py
示例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]
开发者ID:ZDBioHazard,项目名称:quodlibet,代码行数:8,代码来源:test_library_libraries.py
示例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()
开发者ID:LudoBike,项目名称:quodlibet,代码行数:18,代码来源:test_qltk_filesel.py
示例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')
开发者ID:Konzertheld,项目名称:quodlibet,代码行数:9,代码来源:test_plugins_songsmenu.py
示例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")
开发者ID:piotrdrag,项目名称:quodlibet,代码行数:10,代码来源:test_plugins_playlist.py
示例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, [])
开发者ID:ZDBioHazard,项目名称:quodlibet,代码行数:10,代码来源:test_plugins_events.py
示例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)
开发者ID:bossjones,项目名称:quodlibet,代码行数:10,代码来源:test_browsers_playlists.py
示例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()
开发者ID:LudoBike,项目名称:quodlibet,代码行数:12,代码来源:test_util_cover.py
示例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])) == []
开发者ID:ZDBioHazard,项目名称:quodlibet,代码行数:13,代码来源:test_library_libraries.py
示例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()
开发者ID:LudoBike,项目名称:quodlibet,代码行数:22,代码来源:test_plugins_cover.py
示例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()
开发者ID:urielz,项目名称:quodlibet,代码行数:14,代码来源:test_util_cover.py
示例12: reset_environment
def reset_environment(self):
config.init()
self.root_path = mkdtemp()
self.filenames = \
['cover.jpg', 'info.jpg', 'title.jpg', 'title2.jpg']
开发者ID:LudoBike,项目名称:quodlibet,代码行数:5,代码来源:test_qltk_renamefiles.py
示例13: setUp
def setUp(self):
self.dir = mkdtemp()
开发者ID:ZDBioHazard,项目名称:quodlibet,代码行数:2,代码来源:test_util_atomic.py
示例14: setUp
def setUp(self):
self.temp = mkdtemp()
self.temp2 = mkdtemp()
开发者ID:Konzertheld,项目名称:quodlibet,代码行数:3,代码来源:test_util_collection.py
示例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)
开发者ID:vrasidas,项目名称:quodlibet,代码行数:5,代码来源:test_qltk_tracker.py
示例16: setUp
def setUp(self):
super(TFileBackedPlaylist, self).setUp()
self.temp = mkdtemp()
self.temp2 = mkdtemp()
开发者ID:ZDBioHazard,项目名称:quodlibet,代码行数:4,代码来源:test_util_collection.py
示例17: setUp
def setUp(self):
# on osx the temp folder returned is a symlink
self.root = os.path.realpath(mkdtemp())
开发者ID:ZDBioHazard,项目名称:quodlibet,代码行数:3,代码来源:test_library_libraries.py
示例18: setUp
def setUp(self):
self.d = mkdtemp("ql-mod")
sys.modules["qlfake"] = imp.new_module("qlfake")
开发者ID:ZDBioHazard,项目名称:quodlibet,代码行数:3,代码来源:test_util_modulescanner.py
示例19: mkdtemp
import os
import shutil
from gi.repository import Gtk
from quodlibet.browsers import Browser
from quodlibet.library import SongLibrary
from quodlibet.plugins.playlist import PlaylistPlugin, PlaylistPluginHandler
from quodlibet.util.collection import Playlist
from tests import TestCase, mkstemp, mkdtemp
from quodlibet.plugins import PluginManager, Plugin
from tests.helper import capture_output
MAX_PLAYLISTS = 50
DIR = mkdtemp()
TEST_PLAYLIST = Playlist(DIR, "foo")
def generate_playlists(n):
return [Playlist(DIR, "Playlist %d" % x) for x in range(n)]
class TPlaylistPlugins(TestCase):
class MockBrowser(Browser):
def __init__(self):
super(TPlaylistPlugins.MockBrowser, self).__init__()
self.activated = False
def activate(self):
self.activated = True
开发者ID:piotrdrag,项目名称:quodlibet,代码行数:30,代码来源:test_plugins_playlist.py
注:本文中的tests.mkdtemp函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论