[svn r59615] given the format and the fact that external timeout logic may kill a py.test emitting a resultlog switching to line buffering
seems a good idea --HG-- branch : trunk
This commit is contained in:
parent
03f51e5edb
commit
c52d8bcdde
|
@ -28,7 +28,7 @@ class ResultLog(object):
|
||||||
|
|
||||||
def __init__(self, bus, logfile):
|
def __init__(self, bus, logfile):
|
||||||
bus.subscribe(self.log_event_to_file)
|
bus.subscribe(self.log_event_to_file)
|
||||||
self.logfile = logfile #open(logpath, 'w') # line buffering ?
|
self.logfile = logfile # preferably line buffered
|
||||||
|
|
||||||
def write_log_entry(self, shortrepr, name, longrepr):
|
def write_log_entry(self, shortrepr, name, longrepr):
|
||||||
print >>self.logfile, "%s %s" % (shortrepr, name)
|
print >>self.logfile, "%s %s" % (shortrepr, name)
|
||||||
|
|
|
@ -37,7 +37,7 @@ class Session(object):
|
||||||
self.bus.subscribe(eventwrite)
|
self.bus.subscribe(eventwrite)
|
||||||
resultlog = self.config.option.resultlog
|
resultlog = self.config.option.resultlog
|
||||||
if resultlog:
|
if resultlog:
|
||||||
f = py.path.local(resultlog).open('w')
|
f = open(resultlog, 'w', 1) # line buffered
|
||||||
self.resultlog = ResultLog(self.bus, f)
|
self.resultlog = ResultLog(self.bus, f)
|
||||||
|
|
||||||
def fixoptions(self):
|
def fixoptions(self):
|
||||||
|
|
|
@ -196,8 +196,6 @@ class TestSessionAndOptions(suptest.FileCreation):
|
||||||
rep_ev = event.ItemTestReport(item, passed=outcome)
|
rep_ev = event.ItemTestReport(item, passed=outcome)
|
||||||
|
|
||||||
session.bus.notify(rep_ev)
|
session.bus.notify(rep_ev)
|
||||||
|
|
||||||
session.resultlog.logfile.flush()
|
|
||||||
|
|
||||||
s = resultlog.read()
|
s = resultlog.read()
|
||||||
assert s.find(". a") != -1
|
assert s.find(". a") != -1
|
||||||
|
|
Loading…
Reference in New Issue