Example #1
0
    def test_updating_windows_path_only_update_repo_path_if_on_windows(self):
        """testing if updating the windows path will only update the path if
        the system is windows
        """
        self.patcher.patch('Linux')

        from stalker import db, defaults
        db.setup({'sqlalchemy.url': 'sqlite:///:memory:'})

        repo = Repository(name='Test Repo',
                          linux_path='/mnt/T',
                          osx_path='/Volumes/T',
                          windows_path='T:/')
        db.DBSession.add(repo)
        db.DBSession.commit()

        import os
        self.assertTrue(defaults.repo_env_var_template %
                        {'id': repo.id} in os.environ)

        # now update the repository
        test_value = 'S:/'
        repo.windows_path = test_value

        # expect the environment variable not updated
        self.assertNotEqual(
            os.environ[defaults.repo_env_var_template % {
                'id': repo.id
            }], test_value)
        self.assertEqual(
            os.environ[defaults.repo_env_var_template % {
                'id': repo.id
            }], repo.linux_path)

        # make it windows
        self.patcher.patch('Windows')

        # now update the repository
        test_value = 'S:/'
        repo.windows_path = test_value

        # expect the environment variable not updated
        self.assertEqual(
            os.environ[defaults.repo_env_var_template % {
                'id': repo.id
            }], test_value)
        self.assertEqual(
            os.environ[defaults.repo_env_var_template % {
                'id': repo.id
            }], repo.windows_path)
Example #2
0
    def test_updating_windows_path_only_update_repo_path_if_on_windows(self):
        """testing if updating the windows path will only update the path if
        the system is windows
        """
        self.patcher.patch('Linux')
        from stalker import Repository
        repo = Repository(name='Test Repo',
                          linux_path='/mnt/T',
                          osx_path='/Volumes/T',
                          windows_path='T:/')
        from stalker.db.session import DBSession
        DBSession.add(repo)
        DBSession.commit()

        import os
        from stalker import defaults
        assert defaults.repo_env_var_template % {'id': repo.id} in os.environ

        # now update the repository
        test_value = 'S:/'
        repo.windows_path = test_value

        # expect the environment variable not updated
        assert \
            os.environ[defaults.repo_env_var_template % {'id': repo.id}] != \
            test_value
        assert \
            os.environ[defaults.repo_env_var_template % {'id': repo.id}] == \
            repo.linux_path

        # make it windows
        self.patcher.patch('Windows')

        # now update the repository
        test_value = 'S:/'
        repo.windows_path = test_value

        # expect the environment variable not updated
        assert \
            os.environ[defaults.repo_env_var_template % {'id': repo.id}] == \
            test_value
        assert \
            os.environ[defaults.repo_env_var_template % {'id': repo.id}] == \
            repo.windows_path
Example #3
0
print(anim.computed_end)  # 2014-04-23 17:00:00

print(lighting.computed_start)  # 2014-04-23 17:00:00
print(lighting.computed_end)  # 2014-04-24 11:00:00

print(comp.computed_start)  # 2014-04-24 11:00:00
print(comp.computed_end)  # 2014-04-24 17:00:00

print(my_studio.to_tjp)
print(me.to_tjp)
print(comp.to_tjp)
print(new_project.to_tjp)

commercial_repo.linux_path = "/mnt/M/commercials"
commercial_repo.osx_path = "/Volumes/M/commercials"
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")
Example #4
0
print(anim.computed_end)         # 2014-04-23 17:00:00

print(lighting.computed_start)   # 2014-04-23 17:00:00
print(lighting.computed_end)     # 2014-04-24 11:00:00

print(comp.computed_start)       # 2014-04-24 11:00:00
print(comp.computed_end)         # 2014-04-24 17:00:00

print(my_studio.to_tjp)
print(me.to_tjp)
print(comp.to_tjp)
print(new_project.to_tjp)

commercial_repo.linux_path   = "/mnt/M/commercials"
commercial_repo.osx_path     = "/Volumes/M/commercials"
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