Ejemplo n.º 1
0
 def test_runs_on_local(self):
     """
     @run_on_remote runs function locally if no hosts are defined
     """
     with settings(hosts=[]):
         func = fake_function(callable=True, expect_call=True).times_called(1).returns('local')
         task = decorators.runs_on_remote()(func)
         ret = task()
         assert ret == 'local'
Ejemplo n.º 2
0
 def test_runs_on_remote(self):
     """
     @run_on_remote runs function on remote machine instead of locally
     """
     with settings(hosts=['localhost']):
         func = fake_function(callable=True).times_called(0).returns('local')
         #test server doesn't handle the ch context manager used in
         #run_on_remote unless it's an empty string
         task = decorators.runs_on_remote(remote_fabfile_path='')(func)
         ret = task()
         assert ret == 'remote'