On Sun, Mar 27, 2022 at 2:50 PM Guido van Rossum <[email protected]> wrote:
> Hopefully it only prints the first line of the docstring? > Indeed, it's just the first line (traditionally a one line summary per style). https://github.com/python/cpython/blob/f6b3a07b7df60dc04d0260169ffef6e9796a2124/Lib/unittest/runner.py#L46 > > On Sun, Mar 27, 2022 at 2:42 PM Gregory P. Smith <[email protected]> wrote: > >> For many of us, this isn't a nuisance. It is a desirable feature. >> >> test_xxx functions and methods typically don't have docstrings at all as >> the majority of tests tend to be concise and obvious with the function name >> itself describes what its purpose is. When we added printing the >> docstring, it was useful, as you can expand upon the purpose of the test >> more than you can in a reasonable name within the docstring. We do this >> all the many times in our own test suite. When running the tests, you see >> the docstring and are given more context as to what the test is about. >> This can be useful when triaging a failure before you've even loaded the >> source. >> >> I don't doubt that someone writes thesis defenses and stores them in >> their TestCase.test_method docstrings. I'm just saying that is not the norm. >> >> I'd accept a PR adding another command line switch for unittest to >> disable docstring printing in verbose mode. >> >> -gps >> >> >> On Sun, Mar 27, 2022 at 12:59 PM Barry Warsaw <[email protected]> wrote: >> >>> On Mar 26, 2022, at 17:48, Itay Yeshaya <[email protected]> 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. >>> >>> This has been a long-standing nuisance, but I’m like Guido. I pretty >>> much use pytest for everything these days, except for maybe >>> unittest.mock.patch. >>> >>> -Barry >>> >>> >>> _______________________________________________ >>> Python-Dev mailing list -- [email protected] >>> To unsubscribe send an email to [email protected] >>> https://mail.python.org/mailman3/lists/python-dev.python.org/ >>> Message archived at >>> https://mail.python.org/archives/list/[email protected]/message/ZIMXSRQMWFOE4U3C3MBK6SG5TH26PDRL/ >>> Code of Conduct: http://python.org/psf/codeofconduct/ >>> >> _______________________________________________ >> Python-Dev mailing list -- [email protected] >> To unsubscribe send an email to [email protected] >> https://mail.python.org/mailman3/lists/python-dev.python.org/ >> Message archived at >> https://mail.python.org/archives/list/[email protected]/message/RJOWQWMMUMBJAZZTWXWEAJSRDVARA2XL/ >> Code of Conduct: http://python.org/psf/codeofconduct/ >> > > > -- > --Guido van Rossum (python.org/~guido) > *Pronouns: he/him **(why is my pronoun here?)* > <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/> >
_______________________________________________ Python-Dev mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/YULIAATNZVWHHJEASJY3P5UMC4G7ZIPC/ Code of Conduct: http://python.org/psf/codeofconduct/
