Exemple #1
0
def run(args=[]):
    """
    :throw: subprocess.CalledProcessError if something goes wrong
    """
    args = ["python", CLI_SCRIPT] + args
    devnull = open("/dev/null", 'w')

    env = os.environ.copy()
    env["PYTHONPATH"] = os.path.join(C.selfdir(), "..")

    subprocess.check_call(args, stdout=devnull, stderr=devnull, env=env)
Exemple #2
0
#
# Copyright (C) 2015 Satoru SATOH <ssato at redhat.com>
#
import os.path
import os
import subprocess
import unittest

import jinja2_cli.cli as TT
import jinja2_cli.tests.common as C


CLI_SCRIPT = os.path.join(C.selfdir(), "..", "cli.py")


def run(args=[]):
    """
    :throw: subprocess.CalledProcessError if something goes wrong
    """
    args = ["python", CLI_SCRIPT] + args
    devnull = open("/dev/null", 'w')

    env = os.environ.copy()
    env["PYTHONPATH"] = os.path.join(C.selfdir(), "..")

    subprocess.check_call(args, stdout=devnull, stderr=devnull, env=env)


def run_and_check_exit_code(args=[], code=0):
    try:
        TT.main(["dummy"] + args)