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: Too narrow platform check in test_datetime
Type: behavior Stage: resolved
Components: Tests, Windows Versions: Python 3.1, Python 3.2, Python 2.7, Python 2.6
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: belopolsky Nosy List: akrpic77, belopolsky, brian.curtin, mark.dickinson, r.david.murray
Priority: normal Keywords: 26backport, patch

Created on 2010-02-07 22:16 by akrpic77, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
test_datetime_win32_check.patch akrpic77, 2010-02-07 22:16 test_datetime patch
issue7879.diff belopolsky, 2010-05-26 20:31
Messages (10)
msg99026 - (view) Author: Andrej Krpic (akrpic77) Date: 2010-02-07 22:16
Windows doesn't accept negative timestamps (stated in the comment), yet checks is made against os.name instead of sys.platform.

patch fixes that, and also enables windows ce to pass on this test.

I think this is better than having os.name in ("nt", "ce").
msg106532 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2010-05-26 15:23
This looks fine to me.  Alexander?
msg106544 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2010-05-26 17:06
Mark,

I have zero experience with Windows and don't even have a win32 machine to test the patch.

On the other hand the patch is so simple that I think it can be reviewed based on theoretical considerations.

This is probably bikesheding, but I have a slight preference for  os.name in ("nt", "ce").  The reason is that sys.platform is fixed when python is built while os.name is (in theory) determined at run-time.

Also, sys.platform == "win32", appears to be false on 64 bit Windows, but I think it is actually true.

Finally, explicit better than implicit.  A change from if os.name == "nt" to  os.name in ("nt", "ce") gives obviously a strictly wider check. On the other hand it is not obvious to me how the current patch will affect Cygwin platform.
msg106547 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2010-05-26 17:15
sys.platform will be "win32" for both 32 and 64-bit Windows.

As for Cygwin, os.name is "posix" there, and sys.platform is "cygwin", so it should be unaffected.

The patch looks fine to me, and we do typically use sys.platform more often than the os.name check.
msg106549 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2010-05-26 17:23
OK, I'll commit it then.
msg106575 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2010-05-26 20:31
Committed in r81555 (trunk) and r81556 (py3k).  Is this a 2.6 backport candidate?  I don't think so.

Leaving this open to consider using newer unittest.skipIf mechanism.  See attached patch, issue7879.diff.
msg106576 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2010-05-26 20:36
The skipIf patch looks good to me (though I haven't tested it).
msg106577 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2010-05-26 20:38
From IRC:

Taggnostr: imho tests and doc updates can be backported
msg106579 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2010-05-26 20:50
SkipIf patch committed in r81559 (trunk) and r81560 (py3k).
msg106792 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2010-05-31 16:23
- 26backport committed in r81618.
- merged to release31-maint in r81619.

The skipIf patch blocked from release26-maint (skipIf is new in 2.7) and merged into release31-maint in r81620.
History
Date User Action Args
2022-04-11 14:56:57adminsetgithub: 52127
2011-07-21 11:50:20r.david.murraysetmessages: - msg140810
2011-07-21 11:50:02r.david.murraysetnosy: + r.david.murray
messages: + msg140810
2010-05-31 16:23:18belopolskysetstatus: open -> closed

messages: + msg106792
stage: commit review -> resolved
2010-05-26 20:50:22belopolskysetmessages: + msg106579
2010-05-26 20:39:39belopolskysetversions: + Python 2.6, Python 3.1, Python 3.2
2010-05-26 20:38:06belopolskysetkeywords: + 26backport

messages: + msg106577
2010-05-26 20:36:30mark.dickinsonsetmessages: + msg106576
2010-05-26 20:31:13belopolskysetfiles: + issue7879.diff

messages: + msg106575
2010-05-26 17:23:15belopolskysetresolution: accepted
messages: + msg106549
2010-05-26 17:15:04brian.curtinsetnosy: + brian.curtin
messages: + msg106547
2010-05-26 17:06:19belopolskysetmessages: + msg106544
2010-05-26 16:13:42belopolskysetassignee: belopolsky
stage: commit review
2010-05-26 15:23:01mark.dickinsonsetnosy: + mark.dickinson, belopolsky
messages: + msg106532
2010-05-10 12:18:37akrpic77settype: behavior
components: + Windows
2010-02-07 22:16:33akrpic77create