process = subprocess.Popen(command, shell=False, stdin=subprocess.PIPE,
    stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
How to supply stdin, files and environment variable inputs to Python unit tests?