stubtest_unused: fix for py36 and earlier (#4187)

Co-authored-by: hauntsaninja <>
This commit is contained in:
Shantanu
2020-06-06 07:50:50 -07:00
committed by GitHub
parent 9ab4ec568d
commit 7c5a4c96ca

View File

@@ -22,16 +22,11 @@ def main() -> int:
def run_stubtest() -> List[str]:
popen = subprocess.Popen(
["./tests/stubtest_test.py"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True,
proc = subprocess.run(
["./tests/stubtest_test.py"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT
)
assert popen.stdout is not None
unused = []
for line in popen.stdout:
if line.startswith(_UNUSED_NOTE):
unused.append(line[len(_UNUSED_NOTE):].strip())
popen.wait()
return unused
output = proc.stdout.decode("utf-8").splitlines()
return [line[len(_UNUSED_NOTE):].strip() for line in output if line.startswith(_UNUSED_NOTE)]
def unused_files(unused: str) -> List[Tuple[str, str]]: