[TIP] how can I find in TestCase whether runs verbosely?

Matěj Cepl mcepl at redhat.com
Mon Feb 18 01:01:59 PST 2013


On 18/02/13 00:29, Robert Collins wrote:
> Can I ask why?
> 
> Background:
> The idea is that there are two completely separate(*) things happening :
> Tests are running
> Something is showing the result of those tests to users.
> 
> [...]
>
> So I'm guessing you have something you want to do, but I'm not sure
> why the test case needs to know.

Maybe what I need is --debug mode.

I am trying (as my lame attempt to commemorate Aaron Swartz) to make
html2text.py (http://luther.ceplovi.cz/git/html2text.git) fully tested
and working on Python 2.4-3.3 (both inclusive). Generally the tests are
in a simple manner (I know, it is not the best possible manner of
testing, but complete rewrite of the test suite is something I would
rather avoid) ... take a HTML file, run it through the process, and
compare the result with stored text file (actually, it is a Markdown) by
plain self.assertEqual.

You are right that for normal running of the test suite (to make sure,
that nothing has been broken) both in verbose and non-verbose mode, it
is probably best to leave the things as they are, but now when I am
debugging some really intricate case, it might be useful (and maybe not,
and I should use pdb more) to let the test suite to spit out generated
text files for deeper analysis.

What do you think?

Best,

Matěj



More information about the testing-in-python mailing list