本文整理汇总了Python中tank.folder.process_filesystem_structure函数的典型用法代码示例。如果您正苦于以下问题:Python process_filesystem_structure函数的具体用法?Python process_filesystem_structure怎么用?Python process_filesystem_structure使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了process_filesystem_structure函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_shot
def test_shot(self):
"""Tests paths used in making a shot are as expected."""
expected_paths = []
shot_path = os.path.join(self.project_root, "%s_%s" % (self.shot["code"], self.seq["code"]))
expected_paths.extend( [self.project_root, shot_path] )
folder.process_filesystem_structure(self.tk,
self.shot["type"],
self.shot["id"],
preview=False,
engine=None)
assert_paths_to_create(expected_paths)
# now check the path cache!
# there shouldbe two entries, one for the shot and one for the seq
pc = path_cache.PathCache(self.pipeline_configuration)
shot_paths = pc.get_paths("Shot", self.shot["id"], primary_only=False)
seq_paths = pc.get_paths("Sequence", self.seq["id"], primary_only=False)
self.assertEquals( len(shot_paths), 1 )
self.assertEquals( len(seq_paths), 1)
pc.close()
# it's the same folder for seq and shot
self.assertEquals(shot_paths, seq_paths)
示例2: test_step_b
def test_step_b(self):
"""Tests paths used in making a shot are as expected."""
folder.process_filesystem_structure(self.tk,
self.task2["type"],
self.task2["id"],
preview=False,
engine=None)
expected_paths = []
sequence_path = os.path.join(self.project_root, "sequences", self.seq["code"])
sequences_path = os.path.join(self.project_root, "sequences")
shot_path = os.path.join(sequence_path, self.shot["code"])
step_path = os.path.join(shot_path, self.step2["short_name"])
expected_paths.extend( [self.project_root, sequences_path, sequence_path, shot_path, step_path] )
# add non-entity paths
expected_paths.append(os.path.join(step_path, "publish"))
expected_paths.append(os.path.join(step_path, "images"))
expected_paths.append(os.path.join(step_path, "review"))
expected_paths.append(os.path.join(step_path, "work"))
expected_paths.append(os.path.join(step_path, "work", "snapshots"))
expected_paths.append(os.path.join(step_path, "work", "workspace.mel"))
expected_paths.append(os.path.join(step_path, "out"))
assert_paths_to_create(expected_paths)
示例3: test_context_from_path
def test_context_from_path(self):
"""Testing task based context resolution from path."""
task_path = os.path.join(
self.project_root,
"sequences",
self.seq["code"],
self.shot["code"],
self.task["content"]
)
# before folders exist for the task, we expect
# only the project to be extracted from the path
ctx = self.tk.context_from_path(task_path)
self.assertEqual(ctx.project, {'type': 'Project', 'id': 1, 'name': 'project_name'})
self.assertEqual(ctx.entity, None)
self.assertEqual(ctx.step, None)
self.assertEqual(ctx.task, None)
# create folders
folder.process_filesystem_structure(self.tk,
self.task["type"],
self.task ["id"],
preview=False,
engine=None)
# now we should get a full context, including step
ctx = self.tk.context_from_path(task_path)
self.assertEqual(ctx.project, {'type': 'Project', 'id': 1, 'name': 'project_name'})
self.assertEqual(ctx.entity, {'type': 'Shot', 'id': 1, 'name': 'shot_code'})
self.assertEqual(ctx.step, {'type': 'Step', 'id': 3, 'name': 'step_code'})
self.assertEqual(ctx.task, {'type': 'Task', 'id': 23, 'name': 'task1'})
示例4: test_step_a
def test_step_a(self, get_current_user):
"""Tests paths used in making a shot are as expected."""
get_current_user.return_value = self.humanuser
folder.process_filesystem_structure(self.tk,
self.task["type"],
self.task ["id"],
preview=False,
engine="foo-bar")
expected_paths = []
sequence_path = os.path.join(self.project_root, "sequences", self.seq["code"])
sequences_path = os.path.join(self.project_root, "sequences")
shot_path = os.path.join(sequence_path, self.shot["code"])
sandbox_path = os.path.join(shot_path, self.humanuser["login"])
step_path = os.path.join(sandbox_path, self.step["short_name"])
expected_paths.extend( [self.project_root, sequences_path, sequence_path, shot_path, sandbox_path, step_path] )
# add non-entity paths
expected_paths.append(os.path.join(step_path, "publish"))
expected_paths.append(os.path.join(step_path, "images"))
expected_paths.append(os.path.join(step_path, "review"))
expected_paths.append(os.path.join(step_path, "work"))
expected_paths.append(os.path.join(step_path, "work", "snapshots"))
expected_paths.append(os.path.join(step_path, "work", "workspace.mel"))
expected_paths.append(os.path.join(step_path, "out"))
assert_paths_to_create(expected_paths)
示例5: test_shot
def test_shot(self):
"""Tests paths used in making a shot are as expected."""
sequence_path = os.path.join(self.project_root, "sequences", self.seq["code"])
sequences_path = os.path.join(self.project_root, "sequences")
shot_path = os.path.join(sequence_path, self.shot["code"])
ws_path = os.path.join(shot_path, self.workspace["code"])
expected_paths = [self.project_root,
os.path.join(self.project_root, "assets"),
]
expected_paths.extend( [sequences_path,
sequence_path,
shot_path,
ws_path] )
folder.process_filesystem_structure(self.tk,
self.workspace["type"],
self.workspace["id"],
preview=False,
engine=None)
assert_paths_to_create(expected_paths)
示例6: test_asset
def test_asset(self):
"""Tests paths used in making a asset are as expected."""
# expected paths here are based on sg_standard start-config
# define paths we expect for entities
expected_paths = []
expected_paths.append(self.alt_root_1)
expected_paths.append(os.path.join(self.alt_root_1, "assets"))
expected_paths.append(os.path.join(self.alt_root_1, "alternate_reference"))
asset_folder_name = "%s_%s" % (self.asset["sg_asset_type"], self.asset["code"])
asset_path = os.path.join(self.alt_root_1, "assets", asset_folder_name)
step_path = os.path.join(asset_path, self.step["short_name"])
expected_paths.append(asset_path)
expected_paths.append(step_path)
# add non-entity paths
expected_paths.append(os.path.join(step_path, "publish"))
expected_paths.append(os.path.join(step_path, "images"))
expected_paths.append(os.path.join(step_path, "review"))
expected_paths.append(os.path.join(step_path, "work"))
expected_paths.append(os.path.join(step_path, "work", "snapshots"))
expected_paths.append(os.path.join(step_path, "out"))
folder.process_filesystem_structure(self.tk,
self.asset["type"],
self.asset["id"],
preview=False,
engine=None)
assert_paths_to_create(expected_paths)
示例7: test_list_field_token
def test_list_field_token(self):
"""
Test that we can reference list field tokens in the symlink definition
"""
self.assertFalse(os.path.exists(self.bbb))
self.assertFalse(os.path.exists(self.bbb_work))
self.assertFalse(os.path.exists(self.bbb_link))
folder.process_filesystem_structure(
self.tk,
self.asset_bbb["type"],
self.asset_bbb["id"],
preview=False,
engine=None
)
self.assertTrue(os.path.exists(self.bbb))
self.assertTrue(os.path.exists(self.bbb_work))
if sys.platform != "win32":
self.assertTrue(os.path.lexists(self.bbb_link))
self.assertTrue(os.path.islink(self.bbb_link))
self.assertEqual(os.readlink(self.bbb_link), "../Stuff/project_code/vehicle/bbb")
else:
# no support on windows
self.assertFalse(os.path.exists(self.bbb_link))
示例8: test_create_symlink
def test_create_symlink(self):
"""
Test folder creation for a shot which matches the static folder trigger condition
"""
self.assertFalse(os.path.exists(self.aaa))
self.assertFalse(os.path.exists(self.aaa_work))
self.assertFalse(os.path.exists(self.aaa_link))
folder.process_filesystem_structure(
self.tk,
self.shot_aaa["type"],
self.shot_aaa["id"],
preview=False,
engine=None
)
self.assertTrue(os.path.exists(self.aaa))
self.assertTrue(os.path.exists(self.aaa_work))
if sys.platform != "win32":
self.assertTrue(os.path.lexists(self.aaa_link))
self.assertTrue(os.path.islink(self.aaa_link))
self.assertEqual(os.readlink(self.aaa_link), "../Stuff/project_code/aaa")
else:
# no support on windows
self.assertFalse(os.path.exists(self.aaa_link))
示例9: test_no_new_folders_created
def test_no_new_folders_created(self):
"""
Test the case when folder creation is running for an already existing path
"""
# we should have one Toolkit_Folders_Create record in the path cache,
# coming from the project setup
folder_events = self.tk.shotgun.find("EventLogEntry", [["event_type", "is", "Toolkit_Folders_Create"]])
self.assertEqual(len(folder_events), 1)
folder.process_filesystem_structure(self.tk,
self.seq["type"],
self.seq["id"],
preview=False,
engine=None)
# a seq should have been added to the path cache and we should have two events
folder_events = self.tk.shotgun.find("EventLogEntry", [["event_type", "is", "Toolkit_Folders_Create"]])
self.assertEqual(len(folder_events), 2)
# running this again, no folders should be created and no events should be generated
folder.process_filesystem_structure(self.tk,
self.seq["type"],
self.seq["id"],
preview=False,
engine=None)
folder_events = self.tk.shotgun.find("EventLogEntry", [["event_type", "is", "Toolkit_Folders_Create"]])
self.assertEqual(len(folder_events), 2)
示例10: test_made_string
def test_made_string(self, get_current_user):
self.assertFalse(os.path.exists(self.user_path))
get_current_user.return_value = self.humanuser
folder.process_filesystem_structure(self.tk,
self.shot["type"],
self.shot["id"],
preview=False,
engine="tk-maya")
self.assertTrue(os.path.exists(self.user_path))
get_current_user.return_value = self.humanuser2
folder.process_filesystem_structure(self.tk,
self.shot["type"],
self.shot["id"],
preview=False,
engine="tk-maya")
self.assertTrue(os.path.exists(self.user_path2))
# test user context
ctx_foo = self.tk.context_from_path(self.user_path)
ctx_bar = self.tk.context_from_path(self.user_path2)
self.assertEquals(ctx_foo.filesystem_locations, [self.user_path])
self.assertEquals(ctx_bar.filesystem_locations, [self.user_path2])
示例11: test_create_sequence
def test_create_sequence(self):
expected = os.path.join(self.project_root, "sequences", self.seq["code"])
self.assertFalse(os.path.exists(expected))
folder.process_filesystem_structure(self.tk,
self.seq["type"],
self.seq["id"],
preview=False,
engine=None)
self.assertTrue(os.path.exists(expected))
示例12: test_create_project
def test_create_project(self):
# Check static folders without entity children are created
expected = os.path.join(self.project_root, "reference", "artwork")
self.assertFalse(os.path.exists(expected))
folder.process_filesystem_structure(self.tk,
self.project["type"],
self.project["id"],
preview=False,
engine=None)
self.assertTrue(os.path.exists(expected))
示例13: test_create_task
def test_create_task(self):
# Task should create folders for it's entity
expected = os.path.join(self.project_root, "sequences", self.seq["code"], self.shot["code"])
self.assertFalse(os.path.exists(expected))
folder.process_filesystem_structure(self.tk,
self.task["type"],
self.task["id"],
preview=False,
engine=None)
self.assertTrue(os.path.exists(expected))
示例14: test_not_made_default
def test_not_made_default(self, get_current_user):
self.assertFalse(os.path.exists(self.user_path))
get_current_user.return_value = self.humanuser
folder.process_filesystem_structure(self.tk,
self.shot["type"],
self.shot["id"],
preview=False,
engine=None)
self.assertFalse(os.path.exists(self.user_path))