def test_get_version_from_full_path_with_multiple_repositories(self):
        repo1 = Repository(
            name='Test Repo 1',
            linux_path='/mnt/T/',
            windows_path='T:/',
            osx_path='/Volumes/T/'
        )
        DBSession.add(repo1)

        repo2 = Repository(
            name='Test Repo 2',
            linux_path='/mnt/S/',
            windows_path='S:/',
            osx_path='/Volumes/S/'
        )
        DBSession.add(repo2)

        task_ft = FilenameTemplate(
            name='Task Filename Template',
            target_entity_type='Task',
            path='$REPO{{project.repository.id}}/{{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)}}',
        )
        DBSession.add(task_ft)

        structure1 = Structure(
            name='Commercial Project Structure',
            templates=[task_ft]
        )
        DBSession.add(structure1)

        status1 = Status(name='Status 1', code='STS1')
        status2 = Status(name='Status 2', code='STS2')
        status3 = Status(name='Status 3', code='STS3')
        DBSession.add_all([status1, status2, status3])

        proj_status_list = StatusList(
            name='Project Statuses',
            target_entity_type='Project',
            statuses=[status1, status2, status3]
        )
        DBSession.add(proj_status_list)

        task_status_list = StatusList(
            name='Task Statuses',
            target_entity_type='Task',
            statuses=[status1, status2, status3]
        )
        DBSession.add(task_status_list)

        version_status_list = StatusList(
            name='Version Statuses',
            target_entity_type='Version',
            statuses=[status1, status2, status3]
        )
        DBSession.add(version_status_list)

        project1 = Project(
            name='Test Project 1',
            code='TP1',
            repositories=[repo1],
            structure=structure1,
            status_list=proj_status_list
        )
        DBSession.add(project1)

        project2 = Project(
            name='Test Project 2',
            code='TP2',
            repositories=[repo2],
            structure=structure1,
            status_list=proj_status_list
        )
        DBSession.add(project2)

        task1 = Task(
            name='Test Task 1',
            code='TT1',
            project=project1,
            status_list=task_status_list
        )
        DBSession.add(task1)

        task2 = Task(
            name='Test Task 1',
            code='TT1',
            project=project2,
            status_list=task_status_list
        )
        DBSession.add(task2)

        DBSession.commit()

        # now create versions
        version1 = Version(
            task=task1,
            status_list=version_status_list
        )
        DBSession.add(version1)
        DBSession.commit()
        version1.update_paths()

        version2 = Version(
            task=task2,
            status_list=version_status_list
        )
        DBSession.add(version2)
        DBSession.commit()
        version2.update_paths()

        DBSession.commit()
        logger.debug('version1.full_path : %s' % version1.full_path)
        logger.debug('version2.full_path : %s' % version2.full_path)

        # now try to get the versions with an EnvironmentBase instance
        env = EnvironmentBase()

        # version1
        version1_found = env.get_version_from_full_path(
            '/mnt/T/TP1/Test_Task_1/Test_Task_1_Main_v001'
        )
        self.assertEqual(version1_found, version1)

        # version2
        version2_found = env.get_version_from_full_path(
            '/mnt/S/TP2/Test_Task_1/Test_Task_1_Main_v001'
        )
        self.assertEqual(version2_found, version2)

        # version1 in windows
        version1_found = env.get_version_from_full_path(
            'T:/TP1/Test_Task_1/Test_Task_1_Main_v001'
        )
        self.assertEqual(version1_found, version1)

        # version2 in windows
        version2_found = env.get_version_from_full_path(
            'S:/TP2/Test_Task_1/Test_Task_1_Main_v001'
        )
        self.assertEqual(version2_found, version2)

        # version1 in linux
        version1_found = env.get_version_from_full_path(
            '/mnt/T/TP1/Test_Task_1/Test_Task_1_Main_v001'
        )
        self.assertEqual(version1_found, version1)

        # version2 in linux
        version2_found = env.get_version_from_full_path(
            '/mnt/S/TP2/Test_Task_1/Test_Task_1_Main_v001'
        )
        self.assertEqual(version2_found, version2)

        # version1 in osx
        version1_found = env.get_version_from_full_path(
            '/Volumes/T/TP1/Test_Task_1/Test_Task_1_Main_v001'
        )
        self.assertEqual(version1_found, version1)

        # version2 in osx
        version2_found = env.get_version_from_full_path(
            '/Volumes/S/TP2/Test_Task_1/Test_Task_1_Main_v001'
        )
        self.assertEqual(version2_found, version2)
Write the strings to the underlying file object.
dataset/ETHPy150Open eoyilmaz/anima/tests/env/test_environmentBase.py/EnvironmentBaseTestCase.test_get_version_from_full_path_with_multiple_repositories--crossover with--dataset/ETHPy150Open ricmoo/pycoind/pycoind/util/pyscrypt/file.py/ScryptFile.writelines