From 72052d8338147384bc1e09ba9e313cfb7d0ad16d Mon Sep 17 00:00:00 2001 From: Matthias Kramm Date: Fri, 12 Jan 2018 12:28:19 -0800 Subject: [PATCH] Fix tests to work with newest version of pytype (#1824) --- tests/pytype_test.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/tests/pytype_test.py b/tests/pytype_test.py index f90c4811a..55690fbc9 100755 --- a/tests/pytype_test.py +++ b/tests/pytype_test.py @@ -60,19 +60,23 @@ def load_blacklist(): class BinaryRun(object): - def __init__(self, args, dry_run=False): + def __init__(self, args, dry_run=False, env=None): self.args = args - - self.dry_run = dry_run self.results = None if dry_run: self.results = (0, '', '') else: + if env is not None: + full_env = os.environ.copy() + full_env.update(env) + else: + full_env = None self.proc = subprocess.Popen( self.args, stdout=subprocess.PIPE, - stderr=subprocess.PIPE) + stderr=subprocess.PIPE, + env=full_env) def communicate(self): if self.results: @@ -122,11 +126,11 @@ def pytype_test(args): if f in pytype_run: test_run = BinaryRun( ['pytype', - '--typeshed-location=%s' % os.getcwd(), '--module-name=%s' % _get_module_name(f), - '--convert-to-pickle=%s' % os.devnull, + '--parse-pyi', f], - dry_run=args.dry_run) + dry_run=args.dry_run, + env={"TYPESHED_HOME": os.getcwd()}) elif f in pytd_run: test_run = BinaryRun(['pytd', f], dry_run=args.dry_run) else: