summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Niklas Hasse <jhasse@bixense.com>2018-11-07 17:18:57 (GMT)
committerJan Niklas Hasse <jhasse@bixense.com>2018-11-07 17:20:07 (GMT)
commit44ed3743af5ac879a53b16d58f05d97fe66a3ea4 (patch)
tree420e265eaee3a1927f54d6efbeec78cf8e6f0703
parent0858f2ee48651bcadc67c04caba5a824213faa9d (diff)
downloadNinja-44ed3743af5ac879a53b16d58f05d97fe66a3ea4.zip
Ninja-44ed3743af5ac879a53b16d58f05d97fe66a3ea4.tar.gz
Ninja-44ed3743af5ac879a53b16d58f05d97fe66a3ea4.tar.bz2
Make output_test.py independent of the environment
-rwxr-xr-xmisc/output_test.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/misc/output_test.py b/misc/output_test.py
index d19cebc..6a5b635 100755
--- a/misc/output_test.py
+++ b/misc/output_test.py
@@ -5,21 +5,27 @@
In order to simulate a smart terminal it uses the 'script' command.
"""
+import os
import subprocess
import sys
import tempfile
import unittest
def run(build_ninja, flags='', pipe=False):
+ env = dict(os.environ)
+ if 'NINJA_STATUS' in env:
+ del env['NINJA_STATUS']
+ env['TERM'] = ''
with tempfile.NamedTemporaryFile('w') as f:
f.write(build_ninja)
f.flush()
ninja_cmd = './ninja {} -f {}'.format(flags, f.name)
try:
if pipe:
- output = subprocess.check_output([ninja_cmd], shell=True)
+ output = subprocess.check_output([ninja_cmd], shell=True, env=env)
else:
- output = subprocess.check_output(['script', '-qfec', ninja_cmd, '/dev/null'])
+ output = subprocess.check_output(['script', '-qfec', ninja_cmd, '/dev/null'],
+ env=env)
except subprocess.CalledProcessError as err:
sys.stdout.buffer.write(err.output)
raise err