On Sun, 27 Mar 2022 00:48:04 -0000
"Itay Yeshaya" <itay.yesh...@gmail.com> wrote:
> When running unittest with the -v flag, if a test has errors, and has a 
> docstring, the test name is shown on one line, and the docstring is shown on 
> the next line with the `ERROR` word.
> For example:
> 
> ./python.exe -m unittest -v Lib.test_verbose_error.randomTest
> test_one (Lib.test_verbose_error.randomTest)
> this is a doc string with helpful info ... ERROR
> 
> ======================================================================
> ERROR: test_one (Lib.test_verbose_error.randomTest)
> this is a doc string with helpful info
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "/workspaces/cpython/Lib/test_verbose_error.py", line 11, in test_one
>     assert l[1]
>           ~^^^
> IndexError: list index out of range
> 
> ----------------------------------------------------------------------
> Ran 1 test in 0.004s
> 
> This cause for some confusion and we would like to fix it, the possible 
> options are:

Which confusion is this about?

Unit tests are not APIs, so the only reason to write a docstring is if
you want it to appear in test output.  If you don't want it to appear
in test output, write a comment instead.

Regards

Antoine.


_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/WIWR4F3M4RD6CPA5QTN2VGTPRXEQ3VDT/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to