A frequent error I encounter

  try:
    ...do something...
  except IOError:
    log('encounter an error %s line %d' % filename)

Here in the string interpolation I should supply (filename,lineno). Usually I have a lot of unittesting to catch syntax error in the main code. But it is very difficult to run into exception handler, some of those are added defensely. Unfortunately those untested exception sometimes fails precisely when we need it for diagnosis information.

pychecker sometime give false alarm. The argument of a string interpolation may be a valid tuple. It would be great it we can somehow unit test the exception handler (without building an extensive library of mock objects).
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to