Created
July 31, 2012 04:58
-
-
Save sibson/3213782 to your computer and use it in GitHub Desktop.
circusctl add --start testcase
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
import sys | |
import time | |
from circus.tests.support import TestCircus | |
class TestCommandline(TestCircus): | |
def setUp(self): | |
super(TestCommandline, self).setUp() | |
self.dummy_process = 'circus.tests.test_arbiter.run_dummy' | |
self.test_file = self._run_circus(self.dummy_process) | |
def run_ctl(self, args): | |
cmd = ['circusctl'] | |
proc = subprocess.Popen(cmd + args.split(), stdout=subprocess.PIPE) | |
# use proc.communicate, if we need to handle lots of output | |
while proc.returncode is None: | |
time.sleep(0.1) | |
proc.poll() | |
return proc.stdout.read().strip() | |
def test_add(self): | |
output = self.run_ctl('add test2 "generic.py %s"' % self.dummy_process) | |
self.assertEqual(output, 'ok') | |
output = self.run_ctl('status test2') | |
self.assertEqual(output, 'stopped') | |
def test_add_start(self): | |
output = self.run_ctl('add --start test2 "generic.py %s"' % self.dummy_process) | |
self.assertEqual(output, 'ok') | |
output = self.run_ctl('status test2') | |
self.assertEqual(output, 'started') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment