Noah wrote:
> Is there a way for a test case method in a class derived
> from unittest.TestCase to tell if the harness was started
> with the verbose option? I would like my test cases to
> print out a little extra information if the tests were run with
> -v or -vv.

Looking at the source, it doesn't appear that information is exposed to 
the TestCases.  If you base your tests on this subclass of the standard 
TestCase, however, you can use the regenerated "self._verbosity" 
attribute to do what you want:


class TestCase(unittest.TestCase):
     def run(self, result=None):
         if result.showAll:
             self._verbosity = 2
         elif result.dots:
             self._verbosity = 1
         else:
             self._verbosity = 0
         unittest.TestCase.run(self, result=result)


-Peter

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to