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: