Re: [Python-Dev] [Python-checkins] cpython: Issue #19330: Handle the no-docstrings case in tests
nick.coghlan
http://hg.python.org/cpython/rev/a9bbc2d0c1dc -HAVE_DOCSTRINGS = (check_impl_detail(cpython=False) or - sys.platform == 'win32' or - sysconfig.get_config_var('WITH_DOC_STRINGS')) +# Rather than trying to enumerate all the cases where docstrings may be +# disabled, we just check for that directly + +def _check_docstrings(): + """Just used to check if docstrings are enabled""" + +HAVE_DOCSTRINGS = (_check_docstrings.__doc__ is not None)
requires_docstrings = unittest.skipUnless(HAVE_DOCSTRINGS,
I think that does not detect --without-doc-strings (i.e. the C docstrings are empty). Stefan Krah
26.10.13 15:50, Stefan Krah написав(ла):
nick.coghlan
wrote: http://hg.python.org/cpython/rev/a9bbc2d0c1dc -HAVE_DOCSTRINGS = (check_impl_detail(cpython=False) or - sys.platform == 'win32' or - sysconfig.get_config_var('WITH_DOC_STRINGS')) +# Rather than trying to enumerate all the cases where docstrings may be +# disabled, we just check for that directly + +def _check_docstrings(): + """Just used to check if docstrings are enabled""" + +HAVE_DOCSTRINGS = (_check_docstrings.__doc__ is not None)
requires_docstrings = unittest.skipUnless(HAVE_DOCSTRINGS,
I think that does not detect --without-doc-strings (i.e. the C docstrings are empty).
Indeed. HAVE_DOCSTRINGS was introduced to skip tests for the C docstrings. Python docstrings tests are skipped if sys.flags.optimize >= 2.
On 27 October 2013 01:10, Serhiy Storchaka
26.10.13 15:50, Stefan Krah написав(ла):
nick.coghlan
wrote: http://hg.python.org/cpython/rev/a9bbc2d0c1dc -HAVE_DOCSTRINGS = (check_impl_detail(cpython=False) or - sys.platform == 'win32' or - sysconfig.get_config_var('WITH_DOC_STRINGS')) +# Rather than trying to enumerate all the cases where docstrings may be +# disabled, we just check for that directly + +def _check_docstrings(): + """Just used to check if docstrings are enabled""" + +HAVE_DOCSTRINGS = (_check_docstrings.__doc__ is not None)
requires_docstrings = unittest.skipUnless(HAVE_DOCSTRINGS,
I think that does not detect --without-doc-strings (i.e. the C docstrings are empty).
Indeed. HAVE_DOCSTRINGS was introduced to skip tests for the C docstrings. Python docstrings tests are skipped if sys.flags.optimize >= 2.
That's *extraordinarily* confusing, especially when Serhiy suggested I use the flag when testing a pure Python module. Regards, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia
On 27 October 2013 03:32, Nick Coghlan
On 27 October 2013 01:10, Serhiy Storchaka
wrote: 26.10.13 15:50, Stefan Krah написав(ла):
nick.coghlan
wrote: http://hg.python.org/cpython/rev/a9bbc2d0c1dc -HAVE_DOCSTRINGS = (check_impl_detail(cpython=False) or - sys.platform == 'win32' or - sysconfig.get_config_var('WITH_DOC_STRINGS')) +# Rather than trying to enumerate all the cases where docstrings may be +# disabled, we just check for that directly + +def _check_docstrings(): + """Just used to check if docstrings are enabled""" + +HAVE_DOCSTRINGS = (_check_docstrings.__doc__ is not None)
requires_docstrings = unittest.skipUnless(HAVE_DOCSTRINGS,
I think that does not detect --without-doc-strings (i.e. the C docstrings are empty).
Indeed. HAVE_DOCSTRINGS was introduced to skip tests for the C docstrings. Python docstrings tests are skipped if sys.flags.optimize >= 2.
That's *extraordinarily* confusing, especially when Serhiy suggested I use the flag when testing a pure Python module.
http://bugs.python.org/issue19412 Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia
26.10.13 20:32, Nick Coghlan написав(ла):
On 27 October 2013 01:10, Serhiy Storchaka
wrote: 26.10.13 15:50, Stefan Krah написав(ла):
nick.coghlan
wrote: http://hg.python.org/cpython/rev/a9bbc2d0c1dc -HAVE_DOCSTRINGS = (check_impl_detail(cpython=False) or - sys.platform == 'win32' or - sysconfig.get_config_var('WITH_DOC_STRINGS')) +# Rather than trying to enumerate all the cases where docstrings may be +# disabled, we just check for that directly + +def _check_docstrings(): + """Just used to check if docstrings are enabled""" + +HAVE_DOCSTRINGS = (_check_docstrings.__doc__ is not None)
requires_docstrings = unittest.skipUnless(HAVE_DOCSTRINGS,
I think that does not detect --without-doc-strings (i.e. the C docstrings are empty).
Indeed. HAVE_DOCSTRINGS was introduced to skip tests for the C docstrings. Python docstrings tests are skipped if sys.flags.optimize >= 2.
That's *extraordinarily* confusing, especially when Serhiy suggested I use the flag when testing a pure Python module.
I'm sorry for misleading you.
On 27 Oct 2013 04:16, "Serhiy Storchaka"
26.10.13 20:32, Nick Coghlan написав(ла):
On 27 October 2013 01:10, Serhiy Storchaka
wrote: 26.10.13 15:50, Stefan Krah написав(ла):
nick.coghlan
wrote: http://hg.python.org/cpython/rev/a9bbc2d0c1dc -HAVE_DOCSTRINGS = (check_impl_detail(cpython=False) or - sys.platform == 'win32' or - sysconfig.get_config_var('WITH_DOC_STRINGS')) +# Rather than trying to enumerate all the cases where docstrings may
be
+# disabled, we just check for that directly + +def _check_docstrings(): + """Just used to check if docstrings are enabled""" + +HAVE_DOCSTRINGS = (_check_docstrings.__doc__ is not None)
requires_docstrings = unittest.skipUnless(HAVE_DOCSTRINGS,
I think that does not detect --without-doc-strings (i.e. the C docstrings are empty).
Indeed. HAVE_DOCSTRINGS was introduced to skip tests for the C docstrings. Python docstrings tests are skipped if sys.flags.optimize >= 2.
That's *extraordinarily* confusing, especially when Serhiy suggested I use the flag when testing a pure Python module.
I'm sorry for misleading you.
And my apologies for going ahead and assuming I understood what the flag was for rather than seeking clarification. I'll put together a patch to split it into two flags for the different meanings. Cheers, Nick.
_______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe:
https://mail.python.org/mailman/options/python-dev/ncoghlan%40gmail.com
participants (3)
-
Nick Coghlan
-
Serhiy Storchaka
-
Stefan Krah