mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 21:46:42 +08:00
Fix tests to work with newest version of pytype (#1824)
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user