TST fix file descriptor leak and a bad variable name in get_testlog

This commit is contained in:
Mikhail Korobov 2014-03-19 04:18:04 +06:00
parent 75060d1424
commit 60f9dc7a54
1 changed files with 6 additions and 4 deletions

View File

@ -53,11 +53,13 @@ def get_testenv():
def get_testlog():
"""Get Scrapy log of current test, ignoring the rest"""
with open("test.log", "rb") as fp:
loglines = fp.readlines()
thistest = []
loglines = open("test.log").readlines()
for l in loglines[::-1]:
thistest.append(l)
if "[-] -->" in l:
for line in loglines[::-1]:
thistest.append(line)
if "[-] -->" in line:
break
return "".join(thistest[::-1])