Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
53d3645f
Commit
53d3645f
authored
Jan 27, 2012
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #13847: Make test_localtime_failure() more robust
Skip the test if we are unable to find an invalid time_t value.
parent
2cbae98e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
10 deletions
+15
-10
Lib/test/test_time.py
Lib/test/test_time.py
+15
-10
No files found.
Lib/test/test_time.py
View file @
53d3645f
...
...
@@ -345,16 +345,21 @@ class TimeTestCase(unittest.TestCase):
def
test_localtime_failure
(
self
):
# Issue #13847: check for localtime() failure
invalid_time_t
=
2
**
60
try
:
time
.
localtime
(
invalid_time_t
)
except
ValueError
as
err
:
if
str
(
err
)
==
"timestamp out of range for platform time_t"
:
self
.
skipTest
(
"need 64-bit time_t"
)
else
:
raise
except
OSError
:
pass
invalid_time_t
=
None
for
time_t
in
(
-
1
,
2
**
30
,
2
**
33
,
2
**
60
):
try
:
time
.
localtime
(
time_t
)
except
ValueError
as
err
:
if
str
(
err
)
==
"timestamp out of range for platform time_t"
:
self
.
skipTest
(
"need 64-bit time_t"
)
else
:
raise
except
OSError
:
invalid_time_t
=
time_t
break
if
invalid_time_t
is
None
:
self
.
skipTest
(
"unable to find an invalid time_t value"
)
self
.
assertRaises
(
OSError
,
time
.
localtime
,
invalid_time_t
)
self
.
assertRaises
(
OSError
,
time
.
gmtime
,
invalid_time_t
)
self
.
assertRaises
(
OSError
,
time
.
ctime
,
invalid_time_t
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment