This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Fix tests for build --without-doc-strings
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.2, Python 3.3, Python 3.4, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: ezio.melotti, pitrou, python-dev, r.david.murray, serhiy.storchaka, skrah
Priority: normal Keywords: patch

Created on 2013-01-26 13:35 by serhiy.storchaka, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
tests_without_docstrings.patch serhiy.storchaka, 2013-01-26 13:35 Patch for 3.x review
tests_without_docstrings-2.7.patch serhiy.storchaka, 2013-01-26 13:36 Patch for 2.7 review
issue17041-decorator.diff skrah, 2013-01-26 13:59
tests_without_docstrings-2.7_2.patch serhiy.storchaka, 2013-01-26 14:28 review
tests_without_docstrings-3.2_2.patch serhiy.storchaka, 2013-01-26 14:28 review
tests_without_docstrings-3.3_2.patch serhiy.storchaka, 2013-01-26 14:28 review
tests_without_docstrings-2.7_3.patch serhiy.storchaka, 2013-01-26 15:01 review
tests_without_docstrings-3.2_3.patch serhiy.storchaka, 2013-01-26 15:01 review
tests_without_docstrings-3.3_3.patch serhiy.storchaka, 2013-01-26 15:01 review
doctests_without_docstrings.patch serhiy.storchaka, 2013-01-27 18:23 review
Messages (17)
msg180668 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-01-26 13:35
Some tests failed when Python built without docstrings (--without-doc-strings options). Proposed patch fixes most of tests.

Only doctests in test_generators and test_genexps don't fixed. I don't know how to make doctests conditional.

[135/372] test_generators
**********************************************************************
File "/home/serhiy/py/cpython-without-doc-strings/Lib/test/test_generators.py", line ?, in test.test_generators.__test__.email
Failed example:
    print(i.__next__.__doc__)
Expected:
    x.__next__() <==> next(x)
Got:
    <BLANKLINE>
**********************************************************************
1 items had failures:
   1 of  31 in test.test_generators.__test__.email
***Test Failed*** 1 failures.
test test_generators failed -- 1 of 287 doctests failed

[137/372/1] test_genexps
**********************************************************************
File "/home/serhiy/py/cpython-without-doc-strings/Lib/test/test_genexps.py", line ?, in test.test_genexps.__test__.doctests
Failed example:
    print(g.__next__.__doc__)
Expected:
    x.__next__() <==> next(x)
Got:
    <BLANKLINE>
**********************************************************************
1 items had failures:
   1 of  75 in test.test_genexps.__test__.doctests
***Test Failed*** 1 failures.
test test_genexps failed -- 1 of 75 doctests failed
msg180670 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2013-01-26 13:59
I've already committed a decorator in 5c7f92bfe785, but it isn't
quite robust. I think the one in issue17041-decorator.diff should
do the trick.

Also, we then can use support.HAVE_DOCSTRINGS for some doctests.
msg180674 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-01-26 14:28
Oh, I see Stefan already fixed some failures. Here are updated patches.
msg180677 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2013-01-26 14:48
Once upon a time (two years ago?) we fixed the tests so that they ran successfully (skipped when appropriate) with -OO set, which omits docstrings.  We were checking for the optimization level (sys.flags.optimize) then.  It seems like it would make more sense to combine both checks into one decorator.
msg180678 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-01-26 15:01
Patches updated incorporating Stefan's patch.
msg180679 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-01-26 15:07
> It seems like it would make more sense to combine both checks into one decorator.

These are different cases. @unittest.skipIf(sys.flags.optimize >= 2) is about docstrings in Python implemented modules, and @support.requires_docstrings is about docstrings in C implemented modules.
msg180687 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2013-01-26 17:16
Serhiy Storchaka <report@bugs.python.org> wrote:
> > It seems like it would make more sense to combine both checks into one decorator.
> 
> These are different cases. @unittest.skipIf(sys.flags.optimize >= 2) is about docstrings in Python implemented modules, and @support.requires_docstrings is about docstrings in C implemented modules.

But they're always used together, aren't they? I kind of like the idea of a
single decorator.  We could have two different messages "compiled without docstrings"
and "docstrings are omitted with -O2 and above", where the first message
should get priority if both conditions are true.

Given the mood on python-dev concerning --without-doc-strings, I wonder if
we should stick to minimal changes and just skip the tests in test_pydoc.py
instead of fixing them.

Personally I'm happy either way.  David, what do you think?
msg180717 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2013-01-26 22:46
The patches are really small, so +1 for committing this before the
rc1 for 2.7.4 is released.
msg180718 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2013-01-26 22:48
I left some comments but have no indication that they got mailed.
msg180774 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2013-01-27 15:38
Stefan: as Serhiy pointed out, the two parameters control different things.  While it may be true that it is *likely* that someone would use both if they use one, it is not guaranteed.  I think it is better to keep them separate, since while they are related operationally they are otherwise orthogonal, so linking them in the test code just seems wrong :)
msg180778 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2013-01-27 18:00
Right, keeping the cases separate is indeed clearer.

Serhiy, in case you are waiting for my "stick to minimal changes" comment to be
resolved:  People apparently *do* use --without-doc-strings, so the additional
code in test_pydoc.py is really fine.
msg180779 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-01-27 18:07
New changeset 6c0d9d1ce63e by Serhiy Storchaka in branch '2.7':
- Issue #17041: Fix testing when Python is configured with the
http://hg.python.org/cpython/rev/6c0d9d1ce63e

New changeset 241b655c23b6 by Serhiy Storchaka in branch '3.2':
Issue #17041: Fix testing when Python is configured with the
http://hg.python.org/cpython/rev/241b655c23b6

New changeset b2fa459d95d6 by Serhiy Storchaka in branch '3.3':
Issue #17041: Fix testing when Python is configured with the
http://hg.python.org/cpython/rev/b2fa459d95d6

New changeset 754112dc3bbb by Serhiy Storchaka in branch 'default':
Issue #17041: Fix testing when Python is configured with the
http://hg.python.org/cpython/rev/754112dc3bbb
msg180780 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-01-27 18:23
Thank you, Stefan. I got notification about your comments on email and fixed patches.

Here is a patch which fixes doctests (for 2.7 only need replace test.support by test.test_support). I'm not sure this is a right way to do conditional doctests.
msg180784 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2013-01-27 19:23
doctests_without_docstrings.patch looks good to me.
msg181018 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2013-01-31 13:30
Serhiy, if you have time, I think it would be nice to get the remaining
fix into the upcoming release candidates.
msg181021 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-01-31 14:13
New changeset df9f8feb7444 by Serhiy Storchaka in branch '2.7':
Issue #17041: Fix doctesting when Python is configured with the
http://hg.python.org/cpython/rev/df9f8feb7444

New changeset 9c0cd608464e by Serhiy Storchaka in branch '3.2':
Issue #17041: Fix doctesting when Python is configured with the
http://hg.python.org/cpython/rev/9c0cd608464e

New changeset 886f48754f7e by Serhiy Storchaka in branch '3.3':
Issue #17041: Fix doctesting when Python is configured with the
http://hg.python.org/cpython/rev/886f48754f7e

New changeset e6cc582cafce by Serhiy Storchaka in branch 'default':
Issue #17041: Fix doctesting when Python is configured with the
http://hg.python.org/cpython/rev/e6cc582cafce
msg181023 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-01-31 14:19
Thank you for review, Stefan Krah.
History
Date User Action Args
2022-04-11 14:57:41adminsetgithub: 61243
2013-01-31 14:19:36serhiy.storchakasetstatus: open -> closed
resolution: fixed
messages: + msg181023

stage: patch review -> resolved
2013-01-31 14:13:54python-devsetmessages: + msg181021
2013-01-31 13:38:41michael.foordsetnosy: - michael.foord
2013-01-31 13:30:21skrahsetmessages: + msg181018
2013-01-27 19:23:33skrahsetmessages: + msg180784
2013-01-27 18:23:43serhiy.storchakasetfiles: + doctests_without_docstrings.patch

messages: + msg180780
2013-01-27 18:07:45python-devsetnosy: + python-dev
messages: + msg180779
2013-01-27 18:00:25skrahsetmessages: + msg180778
2013-01-27 15:38:14r.david.murraysetmessages: + msg180774
2013-01-26 22:48:30skrahsetmessages: + msg180718
2013-01-26 22:46:38skrahsetmessages: + msg180717
2013-01-26 17:16:20skrahsetmessages: + msg180687
2013-01-26 15:07:26serhiy.storchakasetmessages: + msg180679
2013-01-26 15:01:26serhiy.storchakasetfiles: + tests_without_docstrings-2.7_3.patch, tests_without_docstrings-3.2_3.patch, tests_without_docstrings-3.3_3.patch

messages: + msg180678
2013-01-26 14:48:14r.david.murraysetnosy: + r.david.murray
messages: + msg180677
2013-01-26 14:28:13serhiy.storchakasetfiles: + tests_without_docstrings-2.7_2.patch, tests_without_docstrings-3.2_2.patch, tests_without_docstrings-3.3_2.patch

messages: + msg180674
2013-01-26 13:59:14skrahsetfiles: + issue17041-decorator.diff

messages: + msg180670
2013-01-26 13:36:33serhiy.storchakasetfiles: + tests_without_docstrings-2.7.patch
nosy: + pitrou, ezio.melotti, michael.foord
2013-01-26 13:35:37serhiy.storchakacreate