Issue 6703: cross platform failure and silly test in doctest (original) (raw)

Issue6703

Created on 2009-08-14 16:18 by cjw296, last changed 2022-04-11 14:56 by admin.

Files
File name Uploaded Description Edit
6703.silly.abspath.test.diff techtonik,2010-04-01 14:10 patch
Messages (11)
msg91557 - (view) Author: Chris Withers (cjw296) * (Python committer) Date: 2009-08-14 16:18
Hi All, Line 355 of this code on the 2.6 branch and trunk: http://svn.python.org/view/python/branches/release26- maint/Lib/doctest.py?view=annotate http://svn.python.org/view/python/trunk/Lib/doctest.py?annotate=69012 ...contain a check that doesn't work cross platform. I'd argue that the check is worthless and should be removed. I'm happy to do this, but is this code tested? If not, do I need to add a test when I remove those two lines? cheers, Chris
msg91567 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2009-08-14 19:08
How about removing it and seeing if tests fail?
msg92269 - (view) Author: Chris Withers (cjw296) * (Python committer) Date: 2009-09-04 22:09
Hmm, I don't think tests will fail, however, there are cryptic docs for this... http://docs.python.org/library/doctest.html#basic-api I don't really get what module_relative is about and I've always run into the non- cross-platform issue above when passing an absolute path to DocFileSuite while forgetting to specify module_relative=False. The weird/frustrating thing is that the tests behave *just fine* on Windows with module_relative being the default of True and the absolute path being specified, so I'm not really sure what difference either the module_relative option or the check that the path doesn't start with a / mean... The problem is that while the docs specify that paths must be /-separated, nothing in the code enforces this. So, with module_relative as True, the default: - If you generate and pass an absolute path on Windows, it'll work just fine. - If you pass a '\\'-separated module-relative path, this will work just fine. (You'll end up with base/dir\path\you\supplied, but I doubt `open` will care about that. With module_relative set to False, I'm not really sure what happens... Anyone?
msg102091 - (view) Author: anatoly techtonik (techtonik) Date: 2010-04-01 14:10
Sure doctests should be crossplatform by default when possible. The patch should fix the behavior for windows. It also cleans the doc and code a bit. Can you provide some testcases?
msg102092 - (view) Author: anatoly techtonik (techtonik) Date: 2010-04-01 14:12
http://codereview.appspot.com/815042/show
msg122884 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-11-30 05:33
Patch looks good. One error and style suggestions on rietveld.
msg122891 - (view) Author: Chris Withers (cjw296) * (Python committer) Date: 2010-11-30 07:45
What this patch doesn't appear to address is that there doesn't appear to be any point to module_relative. Can anyone clarify what the intention of this option is? (it doesn't appear to have any meaningful point from my experience...)
msg143776 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-09-09 17:25
The revision you linked to seems to say that Georg was the one who added this code.
msg143779 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2011-09-09 17:36
> The revision you linked to seems to say that Georg was the one who > added this code. Can you elaborate? Line 355 in trunk was last edited by "edloper".
msg143782 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-09-09 17:42
I misread the Subversion viewer, it was actually PJE in r45248 (if I read correctly this time :)
msg143799 - (view) Author: PJ Eby (pje) * (Python committer) Date: 2011-09-09 20:13
No, I only consolidated the two copies of the code to a single function, in order to more easily add the PEP 302 support. The feature was already there.
History
Date User Action Args
2022-04-11 14:56:51 admin set github: 50952
2011-09-09 20:13:38 pje set messages: +
2011-09-09 17:42:35 eric.araujo set nosy: + pjemessages: +
2011-09-09 17:36:01 georg.brandl set messages: +
2011-09-09 17:25:17 eric.araujo set nosy: + georg.brandlmessages: + versions: + Python 3.3, - Python 3.1
2010-11-30 07:45:40 cjw296 set messages: +
2010-11-30 05:33:49 eric.araujo set versions: + Python 3.1, - Python 2.6nosy: + eric.araujomessages: + components: + Library (Lib)stage: patch review
2010-04-01 14:12:49 techtonik set messages: +
2010-04-01 14:10:03 techtonik set files: + 6703.silly.abspath.test.diffnosy: + techtonikmessages: + keywords: + patch
2009-09-04 22:09:47 cjw296 set messages: +
2009-08-14 19:08:30 benjamin.peterson set nosy: + benjamin.petersonmessages: +
2009-08-14 16🔞16 cjw296 create