nose tutorial documentation

logplug

Contents

Source code for logplug

import traceback
from nose.plugins import Plugin

class AfterLog(Plugin):
  """テスト実行後にログを書き出す。
[docs] """ name = 'afterlog' score = 2 # run late def __init__(self): super(AfterLog, self).__init__() def afterTest(self, test): fd = open('/tmp/log.txt', 'a')
[docs] fd.write('after ') fd.write(test.__repr__()) fd.write('\n') fd.close()

Contents