Esempio n. 1
0
 def run(cmd, host=None, background=True):
     ps.append((run_cmd(cmd, host, background=True), host))
Esempio n. 2
0
def process(cmd, host=None, background=True):
    _processes.append((run_cmd(cmd, host, background=True), host))
def run_client(nconns, shost, port, host=None):
    return run_cmd(cli_cmd + [nconns, shost, port], host)
Esempio n. 4
0
import functools
import itertools
import os
import time
from twisted.internet import defer
from twisted.spread import pb

from myutils.testhelpers import run_cmd, kill_with_children
from myutils.twisted_utils import sleep

WITH_PIPENV = run_cmd(['which', 'pipenv']) == 0
DOTENV_SCRIPT = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..',
                             'dotenv.sh')
PYTHON_CMD_PREFIX = ['pipenv', 'run'] if WITH_PIPENV else [DOTENV_SCRIPT]

_processes = []


def process(cmd, host=None, background=True):
    _processes.append((run_cmd(cmd, host, background=True), host))


def kill_all_my_children():
    for p, host in _processes:
        # cannot exit them with .terminate() if they're in mx :-(
        assert kill_with_children(p) == 0


def sock(*args):
    return '/tmp/p4crap-{}.socket'.format('-'.join(str(a) for a in args))
def run_server(port, host=None, wait_to_bind=True):
    server = run_cmd(srv_cmd + [port], host, background=True)
    if wait_to_bind: time.sleep(0.5)
    return server