예제 #1
0
def t_environment_use_unsets_environment_on_exit(self):
    with _with_policy() as pol:
        env = pol._api.create_environment()
        wrapped = pol._api.wrap_environment(env)

        with self.assertRaises(RuntimeError):
            vs.get_current_environment()

        with wrapped.use():
            print(vs.get_current_environment())

        with self.assertRaises(RuntimeError):
            print(vs.get_current_environment())
예제 #2
0
def t_environment_use_restores_environment_on_exit(self):
    with _with_policy() as pol:
        env1 = pol._api.create_environment()
        wrapped1 = pol._api.wrap_environment(env1)

        env2 = pol._api.create_environment()
        wrapped2 = pol._api.wrap_environment(env2)

        with wrapped1.use():
            ce1 = vs.get_current_environment()

            with wrapped2.use():
                self.assertNotEqual(ce1, vs.get_current_environment())

            self.assertEqual(ce1, vs.get_current_environment())
예제 #3
0
def get_environment():
    import vapoursynth
    if Features.ENVIRONMENT_POLICIES:
        return vapoursynth.get_current_environment().use
    else:
        env = vapoursynth.vpy_current_environment()
        return lambda: env
 def __new_cur_env():
     return vapoursynth.get_current_environment().use()
 def _wrapper(*args, **kwargs):
     return wrapper(vs.get_current_environment(), cls(*args, **kwargs))