def setUpClass(cls): """setup test """ # ----------------------------------------------------------------- # start of the setUp # create the environment variable and point it to a temp directory from stalker import db database_url = "sqlite:///:memory:" db.setup({'sqlalchemy.url': database_url}) db.init() cls.temp_repo_path = tempfile.mkdtemp() from stalker import User cls.user1 = User(name='User 1', login='******', email='*****@*****.**', password='******') from stalker import Repository cls.repo1 = Repository(name='Test Project Repository', linux_path=cls.temp_repo_path, windows_path=cls.temp_repo_path, osx_path=cls.temp_repo_path) from stalker import Status cls.status_new = Status.query.filter_by(code='NEW').first() cls.status_wip = Status.query.filter_by(code='WIP').first() cls.status_comp = Status.query.filter_by(code='CMPL').first() from stalker import FilenameTemplate cls.task_template = FilenameTemplate( name='Task Template', target_entity_type='Task', path='{{project.code}}/' '{%- for parent_task in parent_tasks -%}' '{{parent_task.nice_name}}/' '{%- endfor -%}', filename='{{version.nice_name}}' '_v{{"%03d"|format(version.version_number)}}', ) from stalker import Structure cls.structure = Structure(name='Project Struture', templates=[cls.task_template]) from stalker import StatusList cls.project_status_list = \ StatusList.query.filter_by(target_entity_type='Project').first() from stalker import ImageFormat cls.image_format = ImageFormat(name='HD 1080', width=1920, height=1080, pixel_aspect=1.0) # create a test project from stalker import Project cls.project = Project(name='Test Project', code='TP', repository=cls.repo1, status_list=cls.project_status_list, structure=cls.structure, image_format=cls.image_format) cls.task_status_list =\ StatusList.query.filter_by(target_entity_type='Task').first() from stalker import Type cls.character_type = Type(name='Character', code='CHAR', target_entity_type='Asset') from stalker import Task # create a test series of root task cls.task1 = Task(name='Test Task 1', project=cls.project) cls.task2 = Task(name='Test Task 2', project=cls.project) # commit everything from stalker.db.session import DBSession DBSession.add_all([ cls.repo1, cls.status_new, cls.status_wip, cls.status_comp, cls.project_status_list, cls.project, cls.task_status_list, cls.task1, cls.task2, cls.task_template ]) DBSession.commit() cls.version1 = cls.create_version(cls.task1, 'Main') cls.version2 = cls.create_version(cls.task1, 'Main') cls.version3 = cls.create_version(cls.task1, 'Main') # create other reprs # BBOX cls.version4 = cls.create_version(cls.task1, 'Main@BBox') cls.version5 = cls.create_version(cls.task1, 'Main@BBox') cls.version5.is_published = True DBSession.commit() # ASS cls.version6 = cls.create_version(cls.task1, 'Main@ASS') cls.version7 = cls.create_version(cls.task1, 'Main@ASS') cls.version7.is_published = True DBSession.commit() # GPU cls.version8 = cls.create_version(cls.task1, 'Main@GPU') cls.version9 = cls.create_version(cls.task1, 'Main@GPU') # Non default take name cls.version10 = cls.create_version(cls.task1, 'alt1') cls.version11 = cls.create_version(cls.task1, 'alt1') # Hires cls.version12 = cls.create_version(cls.task1, 'alt1@Hires') cls.version13 = cls.create_version(cls.task1, 'alt1@Hires') # Midres cls.version14 = cls.create_version(cls.task1, 'alt1@Midres') cls.version15 = cls.create_version(cls.task1, 'alt1@Midres') # Lores cls.version16 = cls.create_version(cls.task1, 'alt1@Lores') cls.version17 = cls.create_version(cls.task1, 'alt1@Lores') cls.version17.is_published = True # No Repr cls.version18 = cls.create_version(cls.task1, 'NoRepr') cls.version19 = cls.create_version(cls.task1, 'NoRepr') DBSession.commit() # create a buffer for extra created files, which are to be removed cls.remove_these_files_buffer = []
def setUp(self): """set up the test """ super(ReviewTestCase, self).setUp() from stalker import db, User self.user1 = User(name='Test User 1', login='******', email='*****@*****.**', password='******') db.DBSession.add(self.user1) self.user2 = User(name='Test User 2', login='******', email='*****@*****.**', password='******') db.DBSession.add(self.user2) self.user3 = User(name='Test User 2', login='******', email='*****@*****.**', password='******') db.DBSession.add(self.user3) # Review Statuses from stalker import Status with db.DBSession.no_autoflush: self.status_new = Status.query.filter_by(code='NEW').first() self.status_rrev = Status.query.filter_by(code='RREV').first() self.status_app = Status.query.filter_by(code='APP').first() # Task Statuses self.status_wfd = Status.query.filter_by(code='WFD').first() self.status_rts = Status.query.filter_by(code='RTS').first() self.status_wip = Status.query.filter_by(code='WIP').first() self.status_prev = Status.query.filter_by(code='PREV').first() self.status_hrev = Status.query.filter_by(code='HREV').first() self.status_drev = Status.query.filter_by(code='DREV').first() self.status_cmpl = Status.query.filter_by(code='CMPL').first() from stalker import StatusList self.project_status_list = StatusList( target_entity_type='Project', statuses=[self.status_new, self.status_wip, self.status_cmpl]) db.DBSession.add(self.project_status_list) # self.temp_path = tempfile.mkdtemp() from stalker import Repository self.repo = Repository(name='Test Repository', linux_path='/mnt/T/', windows_path='T:/', osx_path='/Volumes/T/') db.DBSession.add(self.repo) from stalker import Structure self.structure = Structure(name='Test Project Structure') db.DBSession.add(self.structure) from stalker import Project self.project = Project(name='Test Project', code='TP', status_list=self.project_status_list, repository=self.repo) db.DBSession.add(self.project) from stalker import Task self.task1 = Task(name='Test Task 1', project=self.project, resources=[self.user1], responsible=[self.user2]) db.DBSession.add(self.task1) self.task2 = Task(name='Test Task 2', project=self.project, responsible=[self.user1]) db.DBSession.add(self.task2) self.task3 = Task(name='Test Task 3', parent=self.task2, resources=[self.user1]) db.DBSession.add(self.task3) self.task4 = Task(name='Test Task 4', project=self.project, resources=[self.user1], depends=[self.task3], responsible=[self.user2], schedule_timing=2, schedule_unit='h') db.DBSession.add(self.task4) self.task5 = Task(name='Test Task 5', project=self.project, resources=[self.user2], depends=[self.task3], responsible=[self.user2], schedule_timing=2, schedule_unit='h') db.DBSession.add(self.task5) self.task6 = Task(name='Test Task 6', project=self.project, resources=[self.user3], depends=[self.task3], responsible=[self.user2], schedule_timing=2, schedule_unit='h') db.DBSession.add(self.task6) self.kwargs = {'task': self.task1, 'reviewer': self.user1} # add everything to the db db.DBSession.commit()
def setUp(self): """setup the tests """ # ----------------------------------------------------------------- # start of the setUp # create the environment variable and point it to a temp directory db.setup() db.init() self.temp_repo_path = tempfile.mkdtemp() self.user1 = User(name='User 1', login='******', email='*****@*****.**', password='******') DBSession.add(self.user1) DBSession.commit() # login as self.user1 from stalker import LocalSession local_session = LocalSession() local_session.store_user(self.user1) local_session.save() self.repo1 = Repository(name='Test Project Repository', linux_path=self.temp_repo_path, windows_path=self.temp_repo_path, osx_path=self.temp_repo_path) self.status_new = Status.query.filter_by(code='NEW').first() self.status_wip = Status.query.filter_by(code='WIP').first() self.status_comp = Status.query.filter_by(code='CMPL').first() self.task_template = FilenameTemplate( name='Task Template', target_entity_type='Task', path='{{project.code}}/' '{%- for parent_task in parent_tasks -%}' '{{parent_task.nice_name}}/' '{%- endfor -%}', filename='{{version.nice_name}}' '_v{{"%03d"|format(version.version_number)}}', ) self.asset_template = FilenameTemplate( name='Asset Template', target_entity_type='Asset', path='{{project.code}}/' '{%- for parent_task in parent_tasks -%}' '{{parent_task.nice_name}}/' '{%- endfor -%}', filename='{{version.nice_name}}' '_v{{"%03d"|format(version.version_number)}}', ) self.shot_template = FilenameTemplate( name='Shot Template', target_entity_type='Shot', path='{{project.code}}/' '{%- for parent_task in parent_tasks -%}' '{{parent_task.nice_name}}/' '{%- endfor -%}', filename='{{version.nice_name}}' '_v{{"%03d"|format(version.version_number)}}', ) self.sequence_template = FilenameTemplate( name='Sequence Template', target_entity_type='Sequence', path='{{project.code}}/' '{%- for parent_task in parent_tasks -%}' '{{parent_task.nice_name}}/' '{%- endfor -%}', filename='{{version.nice_name}}' '_v{{"%03d"|format(version.version_number)}}', ) self.structure = Structure(name='Project Struture', templates=[ self.task_template, self.asset_template, self.shot_template, self.sequence_template ]) self.project_status_list = \ StatusList.query.filter_by(target_entity_type='Project').first() self.image_format = ImageFormat(name='HD 1080', width=1920, height=1080, pixel_aspect=1.0) # create a test project self.project = Project(name='Test Project', code='TP', repository=self.repo1, status_list=self.project_status_list, structure=self.structure, image_format=self.image_format) self.task_status_list =\ StatusList.query.filter_by(target_entity_type='Task').first() self.asset_status_list =\ StatusList.query.filter_by(target_entity_type='Asset').first() self.shot_status_list =\ StatusList.query.filter_by(target_entity_type='Shot').first() self.sequence_status_list =\ StatusList.query.filter_by(target_entity_type='Sequence').first() self.character_type = Type(name='Character', code='CHAR', target_entity_type='Asset') # create a test series of root task self.task1 = Task(name='Test Task 1', project=self.project) self.task2 = Task(name='Test Task 2', project=self.project) self.task3 = Task(name='Test Task 3', project=self.project) # then a couple of child tasks self.task4 = Task(name='Test Task 4', parent=self.task1) self.task5 = Task(name='Test Task 5', parent=self.task1) self.task6 = Task(name='Test Task 6', parent=self.task1) # create a root asset self.asset1 = Asset(name='Asset 1', code='asset1', type=self.character_type, project=self.project) # create a child asset self.asset2 = Asset(name='Asset 2', code='asset2', type=self.character_type, parent=self.task4) # create a root Sequence self.sequence1 = Sequence(name='Sequence1', code='SEQ1', project=self.project) # create a child Sequence self.sequence2 = Sequence(name='Sequence2', code='SEQ2', parent=self.task2) # create a root Shot self.shot1 = Shot(name='SH001', code='SH001', project=self.project) # create a child Shot (child of a Sequence) self.shot2 = Shot(name='SH002', code='SH002', parent=self.sequence1) # create a child Shot (child of a child Sequence) self.shot3 = Shot(name='SH003', code='SH003', parent=self.sequence2) # commit everything DBSession.add_all([ self.repo1, self.status_new, self.status_wip, self.status_comp, self.project_status_list, self.project, self.task_status_list, self.asset_status_list, self.shot_status_list, self.sequence_status_list, self.task1, self.task2, self.task3, self.task4, self.task5, self.task6, self.asset1, self.asset2, self.shot1, self.shot2, self.shot3, self.sequence1, self.sequence2, self.task_template, self.asset_template, self.shot_template, self.sequence_template ]) DBSession.commit() # now create versions def create_version(task, take_name): """Creates a new version :param task: the task :param take_name: the take_name name :return: the version """ # just renew the scene #pymel.core.newFile(force=True) v = Version(task=task, take_name=take_name) v.update_paths() DBSession.add(v) DBSession.commit() #self.maya_env.save_as(v) return v # asset2 self.version1 = create_version(self.asset2, 'Main') self.version2 = create_version(self.asset2, 'Main') self.version3 = create_version(self.asset2, 'Main') self.version3.description = 'Test Description' self.version4 = create_version(self.asset2, 'Take1') self.version5 = create_version(self.asset2, 'Take1') self.version6 = create_version(self.asset2, 'Take1') # task5 self.version7 = create_version(self.task5, 'Main') self.version8 = create_version(self.task5, 'Main') self.version9 = create_version(self.task5, 'Main') self.version10 = create_version(self.task5, 'Take1') self.version11 = create_version(self.task5, 'Take1') self.version12 = create_version(self.task5, 'Take1') # task6 self.version13 = create_version(self.task6, 'Main') self.version14 = create_version(self.task6, 'Main') self.version15 = create_version(self.task6, 'Main') self.version16 = create_version(self.task6, 'Take1') self.version17 = create_version(self.task6, 'Take1') self.version18 = create_version(self.task6, 'Take1') # shot3 self.version19 = create_version(self.shot3, 'Main') self.version20 = create_version(self.shot3, 'Main') self.version21 = create_version(self.shot3, 'Main') self.version22 = create_version(self.shot3, 'Take1') self.version23 = create_version(self.shot3, 'Take1') self.version24 = create_version(self.shot3, 'Take1') # task3 self.version25 = create_version(self.task3, 'Main') self.version26 = create_version(self.task3, 'Main') self.version27 = create_version(self.task3, 'Main') self.version28 = create_version(self.task3, 'Take1') self.version29 = create_version(self.task3, 'Take1') self.version30 = create_version(self.task3, 'Take1') # asset1 self.version31 = create_version(self.asset1, 'Main') self.version32 = create_version(self.asset1, 'Main') self.version33 = create_version(self.asset1, 'Main') self.version34 = create_version(self.asset1, 'Take1') self.version35 = create_version(self.asset1, 'Take1') self.version36 = create_version(self.asset1, 'Take1') # shot2 self.version37 = create_version(self.shot2, 'Main') self.version38 = create_version(self.shot2, 'Main') self.version39 = create_version(self.shot2, 'Main') self.version40 = create_version(self.shot2, 'Take1') self.version41 = create_version(self.shot2, 'Take1') self.version42 = create_version(self.shot2, 'Take1') # shot1 self.version43 = create_version(self.shot1, 'Main') self.version44 = create_version(self.shot1, 'Main') self.version45 = create_version(self.shot1, 'Main') self.version46 = create_version(self.shot1, 'Take1') self.version47 = create_version(self.shot1, 'Take1') self.version48 = create_version(self.shot1, 'Take1') # +- task1 # | | # | +- task4 # | | | # | | +- asset2 # | | +- Main # | | | +- version1 # | | | +- version2 (P) # | | | +- version3 (P) # | | +- Take1 # | | +- version4 (P) # | | +- version5 # | | +- version6 (P) # | | # | +- task5 # | | +- Main # | | | +- version7 # | | | +- version8 # | | | +- version9 # | | +- Take1 # | | +- version10 # | | +- version11 # | | +- version12 (P) # | | # | +- task6 # | +- Main # | | +- version13 # | | +- version14 # | | +- version15 # | +- Take1 # | +- version16 (P) # | +- version17 # | +- version18 (P) # | # +- task2 # | | # | +- sequence2 # | | # | +- shot3 # | +- Main # | | +- version19 # | | +- version20 # | | +- version21 # | +- Take1 # | +- version22 # | +- version23 # | +- version24 # | # +- task3 # | +- Main # | | +- version25 # | | +- version26 # | | +- version27 # | +- Take1 # | +- version28 # | +- version29 # | +- version30 # | # +- asset1 # | +- Main # | | +- version31 # | | +- version32 # | | +- version33 # | +- Take1 # | +- version34 # | +- version35 # | +- version36 # | # +- sequence1 # | | # | +- shot2 # | +- Main # | | +- version37 # | | +- version38 # | | +- version39 # | +- Take1 # | +- version40 # | +- version41 # | +- version42 # | # +- shot1 # +- Main # | +- version43 # | +- version44 # | +- version45 # +- Take1 # +- version46 # +- version47 # +- version48 # Start Condition: # # version15 # version12 # version5 # version2 -> has new published version (version3) # version5 -> Referenced a second time # version2 -> has new published version (version3) # version12 -> Referenced a second time # version5 # version2 -> has new published version (version3) # version5 # version2 -> has new published version (version3) # version45 -> no change # version48 -> no change # # Expected Final Result # version15A -> Derived from version15 # version12A -> Derived from version12 # version5A -> Derived from version5 # version3 -> has new published version (version3) # version5A -> Derived from version5 # version3 -> has new published version (version3) # version12A -> Derived from version12 - The second reference # version5A -> Derived from version5 # version3 -> has new published version (version3) # version5A -> Derived from version5 # version3 -> has new published version (version3) # version45 -> no change # version48 -> no change # create a deep relation self.version2.is_published = True self.version3.is_published = True # new scene # version5 references version2 self.version5.inputs.append(self.version2) self.version5.is_published = True # version12 references version5 self.version12.inputs.append(self.version5) self.version12.is_published = True # version45 references version48 self.version45.is_published = True self.version48.is_published = True self.version45.inputs.append(self.version48) # version15 references version12 and version48 self.version15.inputs.append(self.version12) self.version15.inputs.append(self.version45) # reference_resolution self.reference_resolution = { 'root': [self.version12, self.version45], 'leave': [self.version48, self.version45], 'update': [self.version2], 'create': [self.version5, self.version12] } # create a buffer for extra created files, which are to be removed self.remove_these_files_buffer = [] self.test_environment = TestEnvironment(name='Test Environment') self.test_environment._version = self.version15 if not QtGui.QApplication.instance(): logger.debug('creating a new QApplication') self.app = QtGui.QApplication(sys.argv) else: logger.debug('using the present QApplication: %s' % QtGui.qApp) # self.app = QtGui.qApp self.app = QtGui.QApplication.instance() self.dialog = version_updater.MainDialog( environment=self.test_environment, reference_resolution=self.reference_resolution)
def setUp(self): """set up the test """ db.setup() db.init() # get statuses self.status_new = Status.query.filter_by(code="NEW").first() self.status_wfd = Status.query.filter_by(code="WFD").first() self.status_rts = Status.query.filter_by(code="RTS").first() self.status_wip = Status.query.filter_by(code="WIP").first() self.status_prev = Status.query.filter_by(code="PREV").first() self.status_hrev = Status.query.filter_by(code="HREV").first() self.status_drev = Status.query.filter_by(code="DREV").first() self.status_oh = Status.query.filter_by(code="OH").first() self.status_stop = Status.query.filter_by(code="STOP").first() self.status_cmpl = Status.query.filter_by(code="CMPL").first() self.test_user1 = User(name='Test User 1', login='******', email='*****@*****.**', password='******') self.test_user2 = User(name='Test User 2', login='******', email='*****@*****.**', password='******') self.test_user3 = User(name='Test User 1', login='******', email='*****@*****.**', password='******') self.test_repo = Repository(name='Test Repository') self.test_structure = Structure(name='test structure') # project status list self.test_project_status_list = StatusList( name='Project Statuses', target_entity_type='Project', statuses=[ self.status_new, self.status_wip, self.status_oh, self.status_stop, self.status_cmpl ]) self.test_project1 = Project(name='Test Project 1', code='TP1', repository=self.test_repo, structure=self.test_structure, status_list=self.test_project_status_list) # create three Tasks self.test_task1 = Task(name='Test Task 1', project=self.test_project1) self.test_task2 = Task(name='Test Task 2', project=self.test_project1) self.test_task3 = Task(name='Test Task 3', project=self.test_project1) # add everything to db DBSession.add_all([ self.test_project1, self.test_project_status_list, self.test_repo, self.test_structure, self.test_task1, self.test_task2, self.test_task3, self.test_user1, self.test_user2 ]) DBSession.commit() self.kwargs = { 'task': self.test_task1, 'depends_to': self.test_task2, 'dependency_target': 'onend', 'gap_timing': 0, 'gap_unit': 'h', 'gap_model': 'length' }
def setUpClass(cls): """setup once """ # remove the transaction manager DBSession.remove() cls.repo_path = tempfile.mkdtemp() from anima import defaults defaults.local_storage_path = tempfile.mktemp() db.setup({ 'sqlalchemy.url': 'sqlite:///:memory:', 'sqlalchemy.echo': 'false' }) db.init() # create Power Users Group cls.power_users_group = Group(name='Power Users') DBSession.add(cls.power_users_group) DBSession.commit() # create a LocalSession first cls.admin = User.query.all()[0] cls.lsession = LocalSession() cls.lsession.store_user(cls.admin) cls.lsession.save() # create a repository cls.test_repo1 = Repository(name='Test Repository', windows_path='T:/TestRepo/', linux_path='/mnt/T/TestRepo/', osx_path='/Volumes/T/TestRepo/') cls.test_structure1 = Structure(name='Test Project Structure', templates=[], custom_template='') cls.status_new = Status.query.filter_by(code='NEW').first() cls.status_wip = Status.query.filter_by(code='WIP').first() cls.status_cmpl = Status.query.filter_by(code='CMPL').first() cls.project_status_list = \ StatusList.query.filter_by(target_entity_type=Project).first() # create a couple of projects cls.test_project1 = Project(name='Project 1', code='P1', repository=cls.test_repo1, structure=cls.test_structure1, status_list=cls.project_status_list) cls.test_project2 = Project(name='Project 2', code='P2', repository=cls.test_repo1, structure=cls.test_structure1, status_list=cls.project_status_list) cls.test_project3 = Project(name='Project 3', code='P3', repository=cls.test_repo1, structure=cls.test_structure1, status_list=cls.project_status_list) cls.projects = [ cls.test_project1, cls.test_project2, cls.test_project3 ] cls.test_user1 = User( name='Test User', # groups=[self.power_users_group], login='******', email='*****@*****.**', password='******') DBSession.add(cls.test_user1) DBSession.commit() cls.admin.projects.append(cls.test_project1) cls.admin.projects.append(cls.test_project2) cls.admin.projects.append(cls.test_project3) cls.test_user1.projects.append(cls.test_project1) cls.test_user1.projects.append(cls.test_project2) cls.test_user1.projects.append(cls.test_project3) # project 1 cls.test_task1 = Task( name='Test Task 1', project=cls.test_project1, resources=[cls.admin], ) cls.test_task2 = Task( name='Test Task 2', project=cls.test_project1, resources=[cls.admin], ) cls.test_task3 = Task( name='Test Task 2', project=cls.test_project1, resources=[cls.admin], ) # project 2 cls.test_task4 = Task( name='Test Task 4', project=cls.test_project2, resources=[cls.admin], ) cls.test_task5 = Task( name='Test Task 5', project=cls.test_project2, resources=[cls.admin], ) cls.test_task6 = Task( name='Test Task 6', parent=cls.test_task5, resources=[cls.admin], ) cls.test_task7 = Task( name='Test Task 7', parent=cls.test_task5, resources=[], ) cls.test_task8 = Task( name='Test Task 8', parent=cls.test_task5, resources=[], ) cls.test_task9 = Task( name='Test Task 9', parent=cls.test_task5, resources=[], ) # +-> Project 1 # | | # | +-> Task1 # | | # | +-> Task2 # | | # | +-> Task3 # | # +-> Project 2 # | | # | +-> Task4 # | | # | +-> Task5 # | | # | +-> Task6 # | | # | +-> Task7 (no resource) # | | # | +-> Task8 (no resource) # | | # | +-> Task9 (no resource) # | # +-> Project 3 # record them all to the db DBSession.add_all([ cls.admin, cls.test_project1, cls.test_project2, cls.test_project3, cls.test_task1, cls.test_task2, cls.test_task3, cls.test_task4, cls.test_task5, cls.test_task6, cls.test_task7, cls.test_task8, cls.test_task9 ]) DBSession.commit() cls.all_tasks = [ cls.test_task1, cls.test_task2, cls.test_task3, cls.test_task4, cls.test_task5, cls.test_task6, cls.test_task7, cls.test_task8, cls.test_task9 ] # create versions cls.test_version1 = Version(cls.test_task1, created_by=cls.admin, created_with='Test', description='Test Description') DBSession.add(cls.test_version1) DBSession.commit() cls.test_version2 = Version(cls.test_task1, created_by=cls.admin, created_with='Test', description='Test Description') DBSession.add(cls.test_version2) DBSession.commit() cls.test_version3 = Version(cls.test_task1, created_by=cls.admin, created_with='Test', description='Test Description') cls.test_version3.is_published = True DBSession.add(cls.test_version3) DBSession.commit() cls.test_version4 = Version(cls.test_task1, take_name='Main@GPU', created_by=cls.admin, created_with='Test', description='Test Description') cls.test_version4.is_published = True DBSession.add(cls.test_version4) DBSession.commit() if not QtGui.QApplication.instance(): logger.debug('creating a new QApplication') cls.app = QtGui.QApplication(sys.argv) else: logger.debug('using the present QApplication: %s' % QtGui.qApp) # self.app = QtGui.qApp cls.app = QtGui.QApplication.instance() # cls.test_environment = TestEnvironment() cls.dialog = version_dialog.MainDialog()
def setUp(self): """setup the test """ # setup test database self.config = testing.setUp() db.setup({'sqlalchemy.url': 'sqlite:///:memory:'}) db.init() defaults.server_side_storage_path = tempfile.mkdtemp() self.temp_test_data_folder = tempfile.mkdtemp() self.test_repo_path = tempfile.mkdtemp() self.status_wfd = Status.query.filter_by(code="WFD").first() self.status_rts = Status.query.filter_by(code="RTS").first() self.status_wip = Status.query.filter_by(code="WIP").first() self.status_prev = Status.query.filter_by(code="PREV").first() self.status_hrev = Status.query.filter_by(code="HREV").first() self.status_drev = Status.query.filter_by(code="DREV").first() self.status_oh = Status.query.filter_by(code="OH").first() self.status_stop = Status.query.filter_by(code="STOP").first() self.status_cmpl = Status.query.filter_by(code="CMPL").first() self.task_status_list = StatusList.query\ .filter_by(target_entity_type='Task').first() self.test_project_status_list = StatusList( name="Project Statuses", statuses=[self.status_wip, self.status_prev, self.status_cmpl], target_entity_type='Project', ) db.DBSession.add(self.test_project_status_list) self.test_movie_project_type = Type( name="Movie Project", code='movie', target_entity_type='Project', ) db.DBSession.add(self.test_movie_project_type) self.test_repository_type = Type( name="Test Repository Type", code='test', target_entity_type='Repository', ) db.DBSession.add(self.test_repository_type) self.test_repository = Repository(name="Test Repository", type=self.test_repository_type, linux_path=self.test_repo_path, windows_path=self.test_repo_path, osx_path=self.test_repo_path) db.DBSession.add(self.test_repository) self.test_user1 = User(name="User1", login="******", email="*****@*****.**", password="******") db.DBSession.add(self.test_user1) self.test_ft = FilenameTemplate( name='Task Filename Template', target_entity_type='Task', path='{{project.code}}/{%- for parent_task in parent_tasks -%}' '{{parent_task.nice_name}}/{%- endfor -%}', filename='{{task.nice_name}}_{{version.take_name}}' '_v{{"%03d"|format(version.version_number)}}{{extension}}') db.DBSession.add(self.test_ft) self.test_structure = Structure(name='Movie Project Structure', templates=[self.test_ft]) db.DBSession.add(self.test_structure) self.test_project1 = Project(name="Test Project1", code='tp1', type=self.test_movie_project_type, status_list=self.test_project_status_list, repository=self.test_repository, structure=self.test_structure, lead=self.test_user1) db.DBSession.add(self.test_project1) self.test_task1 = Task(name='Test Task 1', project=self.test_project1) db.DBSession.add(self.test_task1) self.test_task2 = Task(name='Test Task 2', parent=self.test_task1) db.DBSession.add(self.test_task2) # create test data self.test_base_image_path = os.path.join(here, 'test_data/test_image.png') # create test image self.test_image_path = os.path.join(self.temp_test_data_folder, 'test_image.png') shutil.copy(self.test_base_image_path, self.test_image_path) # create image sequence self.test_image_sequence_path = [] for i in range(10): image_path = os.path.join(self.temp_test_data_folder, 'test_image_%03d.png' % i) shutil.copy(self.test_base_image_path, image_path) self.test_image_sequence_path.append(image_path) self.test_media_manager = MediaManager() # create mp4 video self.test_video_path_mp4 = os.path.join(self.temp_test_data_folder, 'test_image.mp4') self.test_media_manager.ffmpeg( **{ 'i': os.path.join(self.temp_test_data_folder, 'test_image_%03d.png'), 'vcodec': 'libx264', 'b:v': '1024k', 'o': self.test_video_path_mp4 }) # create mov video self.test_video_path_mov = os.path.join(self.temp_test_data_folder, 'test_image.mov') self.test_media_manager.ffmpeg( **{ 'i': os.path.join(self.temp_test_data_folder, 'test_image_%03d.png'), 'vcodec': 'libx264', 'b:v': '1024k', 'o': self.test_video_path_mov }) # create mpg video self.test_video_path_mpg = os.path.join(self.temp_test_data_folder, 'test_image.mpg') self.test_media_manager.ffmpeg( **{ 'i': os.path.join(self.temp_test_data_folder, 'test_image_%03d.png'), 'b:v': '1024k', 'o': self.test_video_path_mpg }) db.DBSession.flush() db.DBSession.commit()
def setUp(self): """sets up the test """ db.setup() db.init() self.test_repo_path = tempfile.mkdtemp() # create test data self.test_repo = Repository(name='Test Repository', linux_path=self.test_repo_path, windows_path=self.test_repo_path, osx_path=self.test_repo_path) self.test_task_template = FilenameTemplate( name='Task Template', target_entity_type='Task', path='{{project.code}}/{%- for parent_task in parent_tasks -%}' '{{parent_task.nice_name}}/{%- endfor -%}', filename='{{version.nice_name}}' '_v{{"%03d"|format(version.version_number)}}', ) self.test_structure = Structure(name='Test Project Structure', templates=[self.test_task_template]) self.status_new = Status.query.filter_by(code='NEW').first() self.status_wip = Status.query.filter_by(code='WIP').first() self.status_cmpl = Status.query.filter_by(code='CMPL').first() self.test_project_status_list = \ StatusList.query.filter(target_entity_type='Project').first() self.test_project1 = Project(name='Test Project 1', code='TP1', repository=self.test_repo, structure=self.test_structure, status_list=self.test_project_status_list) DBSession.add(self.test_project1) DBSession.commit() # now create tasks # root tasks self.test_task1 = Task(name='Task1', project=self.test_project1) self.test_task2 = Task(name='Task2', project=self.test_project1) self.test_task3 = Task(name='Task3', project=self.test_project1) # child of Task1 self.test_task4 = Task(name='Task4', parent=self.test_task1) self.test_task5 = Task(name='Task5', parent=self.test_task1) self.test_task6 = Task(name='Task6', parent=self.test_task1) # child of Task2 self.test_task7 = Task(name='Task7', parent=self.test_task2) self.test_task8 = Task(name='Task8', parent=self.test_task2) self.test_task9 = Task(name='Task9', parent=self.test_task2) # child of Task10 self.test_task10 = Task(name='Task10', parent=self.test_task3) self.test_task11 = Task(name='Task11', parent=self.test_task3) self.test_task12 = Task(name='Task12', parent=self.test_task3) DBSession.add_all([ self.test_task1, self.test_task2, self.test_task3, self.test_task4, self.test_task5, self.test_task6, self.test_task7, self.test_task8, self.test_task9, self.test_task10, self.test_task11, self.test_task12 ]) # now create versions for each of leaf tasks # Task4 # Main self.test_version1 = self.create_version(self.test_task4, take_name='Main') self.test_version2 = self.create_version(self.test_task4, take_name='Main') self.test_version3 = self.create_version(self.test_task4, take_name='Main') # Take1 self.test_version4 = self.create_version(self.test_task4, take_name='Take1') self.test_version5 = self.create_version(self.test_task4, take_name='Take1') self.test_version6 = self.create_version(self.test_task4, take_name='Take1') # Take2 self.test_version7 = self.create_version(self.test_task4, take_name='Take2') self.test_version8 = self.create_version(self.test_task4, take_name='Take2') self.test_version9 = self.create_version(self.test_task4, take_name='Take2') # Task5 # Main self.test_version10 = self.create_version(self.test_task5, take_name='Main') self.test_version11 = self.create_version(self.test_task5, take_name='Main') self.test_version12 = self.create_version(self.test_task5, take_name='Main') # Take1 self.test_version13 = self.create_version(self.test_task5, take_name='Take1') self.test_version14 = self.create_version(self.test_task5, take_name='Take1') self.test_version15 = self.create_version(self.test_task5, take_name='Take1') # Take2 self.test_version16 = self.create_version(self.test_task5, take_name='Take2') self.test_version17 = self.create_version(self.test_task5, take_name='Take2') self.test_version18 = self.create_version(self.test_task5, take_name='Take2') # Task6 # Main self.test_version19 = self.create_version(self.test_task6, take_name='Main') self.test_version20 = self.create_version(self.test_task6, take_name='Main') self.test_version21 = self.create_version(self.test_task6, take_name='Main') # Take1 self.test_version22 = self.create_version(self.test_task6, take_name='Take1') self.test_version23 = self.create_version(self.test_task6, take_name='Take1') self.test_version24 = self.create_version(self.test_task6, take_name='Take1') # Take2 self.test_version25 = self.create_version(self.test_task6, take_name='Take2') self.test_version26 = self.create_version(self.test_task6, take_name='Take2') self.test_version27 = self.create_version(self.test_task6, take_name='Take2') # Task7 # Main self.test_version28 = self.create_version(self.test_task7, take_name='Main') self.test_version29 = self.create_version(self.test_task7, take_name='Main') self.test_version30 = self.create_version(self.test_task7, take_name='Main') # Take1 self.test_version31 = self.create_version(self.test_task7, take_name='Take1') self.test_version32 = self.create_version(self.test_task7, take_name='Take1') self.test_version33 = self.create_version(self.test_task7, take_name='Take1') # Take2 self.test_version34 = self.create_version(self.test_task7, take_name='Take2') self.test_version35 = self.create_version(self.test_task7, take_name='Take2') self.test_version36 = self.create_version(self.test_task7, take_name='Take2') # Task8 - will have no versions # Task9 - it is a destination task with versions # Main self.test_version37 = self.create_version(self.test_task9, take_name='Main') self.test_version38 = self.create_version(self.test_task9, take_name='Main') self.test_version39 = self.create_version(self.test_task9, take_name='Main') # Take1 - an existing take self.test_version40 = self.create_version(self.test_task9, take_name='Take1') self.test_version41 = self.create_version(self.test_task9, take_name='Take1') self.test_version42 = self.create_version(self.test_task9, take_name='Take1') # Take3 - a non existing take self.test_version43 = self.create_version(self.test_task9, take_name='Take1') self.test_version44 = self.create_version(self.test_task9, take_name='Take1') self.test_version45 = self.create_version(self.test_task9, take_name='Take1') if not QtGui.QApplication.instance(): self.app = QtGui.QApplication(sys.argv) else: # self.app = QtGui.qApp self.app = QtGui.QApplication.instance() self.dialog = VersionMover()
def test_generic_data_attribute_can_hold_a_wide_variety_of_object_types( self): """testing if the generic_data attribute can hold any kind of object as a list """ new_simple_entity = SimpleEntity(**self.kwargs) from stalker import User test_user = User( name='email', login='******', email='*****@*****.**', password='******', ) from stalker import Department test_department = Department(name='department1') from stalker import Repository test_repo = Repository(name='Test Repository') from stalker import Structure test_struct = Structure(name='Test Project Structure') from stalker import Status, StatusList test_project_status_list = StatusList( name='Project Status List', target_entity_type='Project', statuses=[Status(name='Active', code='ACT')]) from stalker import Project test_proj = Project(name='Test Project 1', code='tp1', repository=test_repo, structure=test_struct, status_list=test_project_status_list) new_simple_entity.generic_data.extend([ test_proj, test_project_status_list, test_struct, test_repo, test_department, test_user ]) from stalker import db db.DBSession.add(new_simple_entity) db.DBSession.commit() # now check if it is added to the database correctly del new_simple_entity new_simple_entity_db = SimpleEntity.query \ .filter_by(name=self.kwargs['name']) \ .first() self.assertTrue(test_proj in new_simple_entity_db.generic_data) self.assertTrue( test_project_status_list in new_simple_entity_db.generic_data) self.assertTrue(test_struct in new_simple_entity_db.generic_data) self.assertTrue(test_repo in new_simple_entity_db.generic_data) self.assertTrue(test_department in new_simple_entity_db.generic_data) self.assertTrue(test_user in new_simple_entity_db.generic_data) db.DBSession.remove()
def test_custom_template_argument_can_be_skipped(self): """testing if the custom_template argument can be skipped """ self.kwargs.pop("custom_template") new_structure = Structure(**self.kwargs) self.assertEqual(new_structure.custom_template, "")
def accept(self): """overridden accept method """ if not self.name_lineEdit.is_valid: QtWidgets.QMessageBox.critical( self, 'Error', 'Please fix <b>name</b> field!' ) return name = self.name_lineEdit.text() custom_template = self.custom_template_plainTextEdit.toPlainText() filename_template_items = \ self.filename_templates_double_list_widget.secondary_items() filename_template_ids = [] for item in filename_template_items: filename_template_id = \ int(item.text().split('(')[-1].split(')')[0]) filename_template_ids.append(filename_template_id) from stalker import FilenameTemplate filename_templates = FilenameTemplate.query\ .filter(FilenameTemplate.id.in_(filename_template_ids)).all() from stalker import Structure from stalker.db.session import DBSession logged_in_user = self.get_logged_in_user() if self.mode == 'Create': # Create a new Structure try: structure = Structure( name=name, templates=filename_templates, custom_template=custom_template, created_by=logged_in_user ) self.structure = structure DBSession.add(structure) DBSession.commit() except Exception as e: DBSession.rollback() QtWidgets.QMessageBox.critical( self, 'Error', str(e) ) return elif self.mode == 'Update': # Update the structure try: self.structure.name = name self.structure.templates = filename_templates self.structure.custom_template = custom_template self.structure.updated_by = logged_in_user DBSession.add(self.structure) DBSession.commit() except Exception as e: DBSession.rollback() QtWidgets.QMessageBox.critical( self, 'Error', str(e) ) return super(MainDialog, self).accept()
def setUp(self): """create test data """ database_url = 'sqlite:///:memory:' db.setup({'sqlalchemy.url': database_url}) db.init() self.temp_repo_path = tempfile.mkdtemp() self.user1 = User(name='User 1', login='******', email='*****@*****.**', password='******') self.repo1 = Repository(name='Test Project Repository', linux_path=self.temp_repo_path, windows_path=self.temp_repo_path, osx_path=self.temp_repo_path) self.status_new = Status.query.filter_by(code='NEW').first() self.status_wip = Status.query.filter_by(code='WIP').first() self.status_comp = Status.query.filter_by(code='CMPL').first() self.task_template = FilenameTemplate( name='Task Template', target_entity_type='Task', path='{{project.code}}/' '{%- for parent_task in parent_tasks -%}' '{{parent_task.nice_name}}/' '{%- endfor -%}', filename='{{version.nice_name}}' '_v{{"%03d"|format(version.version_number)}}', ) self.asset_template = FilenameTemplate( name='Asset Template', target_entity_type='Asset', path='{{project.code}}/' '{%- for parent_task in parent_tasks -%}' '{{parent_task.nice_name}}/' '{%- endfor -%}', filename='{{version.nice_name}}' '_v{{"%03d"|format(version.version_number)}}', ) self.shot_template = FilenameTemplate( name='Shot Template', target_entity_type='Shot', path='{{project.code}}/' '{%- for parent_task in parent_tasks -%}' '{{parent_task.nice_name}}/' '{%- endfor -%}', filename='{{version.nice_name}}' '_v{{"%03d"|format(version.version_number)}}', ) self.sequence_template = FilenameTemplate( name='Sequence Template', target_entity_type='Sequence', path='{{project.code}}/' '{%- for parent_task in parent_tasks -%}' '{{parent_task.nice_name}}/' '{%- endfor -%}', filename='{{version.nice_name}}' '_v{{"%03d"|format(version.version_number)}}', ) self.structure = Structure(name='Project Struture', templates=[ self.task_template, self.asset_template, self.shot_template, self.sequence_template ]) self.project_status_list = StatusList( name='Project Statuses', target_entity_type='Project', statuses=[self.status_new, self.status_wip, self.status_comp]) self.image_format = ImageFormat(name='HD 1080', width=1920, height=1080, pixel_aspect=1.0) # create a test project self.project = Project(name='Test Project', code='TP', repository=self.repo1, status_list=self.project_status_list, structure=self.structure, image_format=self.image_format) # create task hierarchy # # ASSETS # self.assets = Task(name='Assets', project=self.project, responsible=[self.user1]) # # SEQUENCES # self.sequences = Task(name='Sequences', project=self.project, responsible=[self.user1]) self.seq001 = Sequence(name='Seq001', code='Seq001', parent=self.sequences) self.scene_task = Task(name='001_IST', parent=self.seq001) self.scene_previs_type = Type(name='Scene Previs', code='Scene Previs', target_entity_type='Task') self.scene_previs = Task(name='Scene Previs', parent=self.scene_task, type=self.scene_previs_type) self.shots = Task(name='Shots', parent=self.scene_task) self.shot1 = Shot(name='Seq001_001_IST_0010', code='Seq001_001_IST_0010', parent=self.shots) # create shot tasks self.previs = Task(name='Previs', parent=self.shot1) self.camera = Task(name='Camera', parent=self.shot1) self.animation = Task(name='Animation', parent=self.shot1) self.scene_assembly = Task(name='SceneAssembly', parent=self.shot1) self.lighting = Task(name='Lighting', parent=self.shot1) self.comp = Task(name='Comp', parent=self.shot1) # create maya files self.maya_env = Maya() pm.newFile(force=True) sm = pm.PyNode('sequenceManager1') seq1 = sm.create_sequence('001_IST') # create 3 shots shot1 = seq1.create_shot('shot1') shot2 = seq1.create_shot('shot2') shot3 = seq1.create_shot('shot3') # set shot ranges shot1.startFrame.set(1) shot1.endFrame.set(100) shot2.startFrame.set(101) shot2.endFrame.set(200) shot2.sequenceStartFrame.set(101) shot3.startFrame.set(201) shot3.endFrame.set(300) shot3.sequenceStartFrame.set(201) # save the file under scene previs v = Version(task=self.scene_previs) self.maya_env.save_as(v) pm.newFile(force=1) print(v.absolute_full_path)
def test_readme_tutorial_code(setup_sqlite3): """Tests the tutorial code in README.rst """ from stalker import db db.setup() db.init() from stalker.db.session import DBSession assert str(DBSession.connection().engine.url) == 'sqlite://' from stalker import User me = User(name='Erkan Ozgur Yilmaz', login='******', email='*****@*****.**', password='******') # Save the user to database DBSession.save(me) from stalker import Repository repo = Repository(name='Commercial Projects Repository', windows_path='Z:/Projects', linux_path='/mnt/Z/Projects', osx_path='/Volumes/Z/Projects') from stalker import FilenameTemplate task_template = FilenameTemplate( name='Standard Task Filename Template', target_entity_type='Task', # This is for files saved for Tasks path='{{project.repository.path}}/{{project.code}}/' '{%- for parent_task in parent_tasks -%}' '{{parent_task.nice_name}}/' '{%- endfor -%}', # This is Jinja2 template code filename= '{{version.nice_name}}_v{{"%03d"|format(version.version_number)}}') from stalker import Structure standard_folder_structure = Structure( name='Standard Project Folder Structure', templates=[task_template], custom_template= '{{project.code}}/References' # If you need extra folders ) from stalker import Project new_project = Project( name='Test Project', code='TP', structure=standard_folder_structure, repositories=[repo ], # if you have more than one repository you can do it ) from stalker import ImageFormat hd1080 = ImageFormat(name='1080p', width=1920, height=1080) new_project.image_format = hd1080 # Save the project and all the other data it is connected to it DBSession.save(new_project) from stalker import Task, Asset, Shot, Type # define Character asset type char_type = Type(name='Character', code='CHAR', target_entity_type='Asset') character1 = Asset(name='Character 1', code='CHAR1', type=char_type, project=new_project) # Save the Asset DBSession.save(character1) model = Task(name='Model', parent=character1) rigging = Task( name='Rig', parent=character1, depends=[model ], # For project management, define that Rig can not start # before Model ends. ) # Save the new tasks DBSession.save([model, rigging]) # A shot and some tasks for it shot = Shot(name='SH001', code='SH001', project=new_project) # Save the Shot DBSession.save(shot) animation = Task( name='Animation', parent=shot, ) lighting = Task( name='Lighting', parent=shot, depends=[animation], # Lighting can not start before Animation ends, schedule_timing=1, schedule_unit='d', # The task expected to take 1 day to complete resources=[me]) DBSession.save([animation, lighting]) from stalker import Version new_version = Version(task=animation) new_version.update_paths() # to render the naming convention template new_version.extension = '.ma' # let's say that we have created under Maya assert new_version.absolute_full_path == \ "%sTP/SH001/Animation/SH001_Animation_Main_v001.ma" % \ repo.path assert new_version.version_number == 1 new_version2 = Version(task=animation) new_version2.update_paths() # to render the naming convention template new_version2.extension = '.ma' # let's say that we have created under Maya assert new_version2.version_number == 2
def setUp(self): """set up the test """ super(TaskDependencyTestDBCase, self).setUp() from stalker.db.session import DBSession from stalker import User self.test_user1 = User(name='Test User 1', login='******', email='*****@*****.**', password='******') DBSession.add(self.test_user1) self.test_user2 = User(name='Test User 2', login='******', email='*****@*****.**', password='******') DBSession.add(self.test_user2) self.test_user3 = User(name='Test User 3', login='******', email='*****@*****.**', password='******') DBSession.add(self.test_user3) from stalker import Repository self.test_repo = Repository(name='Test Repository') DBSession.add(self.test_repo) from stalker import Structure self.test_structure = Structure(name='test structure') DBSession.add(self.test_structure) from stalker import Project self.test_project1 = Project( name='Test Project 1', code='TP1', repository=self.test_repo, structure=self.test_structure, ) DBSession.add(self.test_project1) DBSession.commit() # create three Tasks from stalker import Task self.test_task1 = Task(name='Test Task 1', project=self.test_project1) DBSession.add(self.test_task1) self.test_task2 = Task(name='Test Task 2', project=self.test_project1) DBSession.add(self.test_task2) self.test_task3 = Task(name='Test Task 3', project=self.test_project1) DBSession.add(self.test_task3) DBSession.commit() self.kwargs = { 'task': self.test_task1, 'depends_to': self.test_task2, 'dependency_target': 'onend', 'gap_timing': 0, 'gap_unit': 'h', 'gap_model': 'length' }
commercial_repo.windows_path = "M:/commercials" # you can use reverse slashes # (\\) if you want print(commercial_repo.path) # under Windows outputs: # M:/commercials # # in Linux and variants: # /mnt/M/commercials # # and in OSX: # /Volumes/M/commercials from stalker import Structure commercial_project_structure = Structure(name="Commercial Projects Structure") # now assign this structure to our project new_project.structure = commercial_project_structure from stalker import FilenameTemplate task_template = FilenameTemplate( name='Task Template for Commercials', target_entity_type='Task', path= '$REPO{{project.repository.id}}/{{project.code}}/{%- for p in parent_tasks -%}{{p.nice_name}}/{%- endfor -%}', filename='{{version.nice_name}}_v{{"%03d"|format(version.version_number)}}' ) # and append it to our project structure
def setUp(self): """setting up the tests """ super(StructureTester, self).setUp() from stalker import Type vers_type = Type( name="Version", code='vers', target_entity_type="FilenameTemplate" ) ref_type = Type( name="Reference", code='ref', target_entity_type="FilenameTemplate" ) # type templates from stalker import FilenameTemplate self.asset_template = FilenameTemplate( name="Test Asset Template", target_entity_type="Asset", type=vers_type ) self.shot_template = FilenameTemplate( name="Test Shot Template", target_entity_type="Shot", type=vers_type ) self.reference_template = FilenameTemplate( name="Test Reference Template", target_entity_type="Link", type=ref_type ) self.test_templates = [self.asset_template, self.shot_template, self.reference_template] self.test_templates2 = [self.asset_template] self.custom_template = "a custom template" self.test_type = Type( name="Commercial Structure", code='comm', target_entity_type='Structure', ) # keyword arguments self.kwargs = { "name": "Test Structure", "description": "This is a test structure", "templates": self.test_templates, "custom_template": self.custom_template, "type": self.test_type, } self.test_structure = Structure(**self.kwargs)
def test_naming_case(self): """Test the case where naming should contain both Sequence Shot and other stuff (this is based on https://github.com/eoyilmaz/anima/issues/23) """ from stalker.db.session import DBSession from stalker import Project, Task, Sequence, Shot, FilenameTemplate, \ Version, Structure ft = FilenameTemplate( name='Normal Naming Convention', target_entity_type='Task', path= '$REPO{{project.repository.id}}/{{project.code}}/{%- for parent_task in parent_tasks -%}{{parent_task.nice_name}}/{%- endfor -%}', filename="""{%- for p in parent_tasks -%} {%- if p.entity_type == 'Sequence' -%} {{p.name}} {%- elif p.entity_type == 'Shot' -%} _{{p.name}}{{p.children[0].name}} {%- endif -%} {%- endfor -%} {%- set fx = parent_tasks[-2] -%} _{{fx.name}}_{{version.take_name}}_v{{"%02d"|format(version.version_number)}}""", ) DBSession.add(ft) st = Structure(name='Normal Project Structure', templates=[ft]) DBSession.add(st) test_project = Project(name='test001', code='test001', structure=st) DBSession.add(test_project) DBSession.commit() seq_task = Task(name='seq', project=test_project) DBSession.add(seq_task) ep101 = Sequence(name='ep101', code='ep101', parent=seq_task) DBSession.add(ep101) shot_task = Task(name='shot', parent=ep101) DBSession.add(shot_task) s001 = Shot(name='s001', code='s001', parent=shot_task) DBSession.add(s001) c001 = Task(name='c001', parent=s001) DBSession.add(c001) effects_scene = Task(name='effectScenes', parent=c001) DBSession.add(effects_scene) fxA = Task(name='fxA', parent=effects_scene) DBSession.add(fxA) maya = Task(name='maya', parent=fxA) DBSession.add(maya) DBSession.commit() v = Version(task=maya) v.update_paths() v.extension = '.ma' DBSession.add(v) DBSession.commit() assert v.filename == 'ep101_s001c001_fxA_Main_v01.ma'