Source

tinpan / integration / utils.py

Full commit
import subprocess
from datetime import datetime
from tinpan.integration.models import BuildRun

def run_test(project):
    run = BuildRun(project=project, command=project.command, start_time=datetime.now())
    run.save()
    
    p = subprocess.Popen(project.command, shell=True, cwd=project.test_bed,
        stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
    
    code = p.wait()
    
    run.end_time = datetime.now()
    run.output = ''.join(p.stdout.readlines())
    run.success = True if not code else False
    run.save()