def pipe_output(read, write): from os import environ environ = environ.copy() from subprocess import Popen vupdate = Popen( ('venv-update', 'venv=', '--version'), env=environ, stdout=write, close_fds=True, ) from os import close from testing.capture_subprocess import read_all close(write) result = read_all(read) vupdate.wait() result = result.decode('US-ASCII') print(result) uncolored = uncolor(result) assert uncolored.startswith('> ') # FIXME: Sometimes this is 'python -m', sometimes 'python2.7 -m'. Weird. import virtualenv assert uncolored.endswith(''' > virtualenv --version %s ''' % virtualenv.__version__) return result, uncolored
def pipe_output(read, write): from os import environ environ = environ.copy() environ['HOME'] = str(Path('.').realpath()) from subprocess import Popen vupdate = Popen( ('venv-update', '--version'), env=environ, stdout=write, close_fds=True, ) from os import close from testing.capture_subprocess import read_all close(write) result = read_all(read) vupdate.wait() result = result.decode('US-ASCII') uncolored = uncolor(result) assert uncolored.startswith('> ') # FIXME: Sometimes this is 'python -m', sometimes 'python2.7 -m'. Weird. assert uncolored.endswith('''\ -m virtualenv virtualenv_run --version 1.11.6 ''') return result, uncolored