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
b7ec8e5a
Commit
b7ec8e5a
authored
Mar 18, 2008
by
Brett Cannon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test_errno was a no-op test; now it actually tests things and uses unittest.
parent
20bda581
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
15 deletions
+34
-15
Lib/test/test_errno.py
Lib/test/test_errno.py
+32
-15
Misc/NEWS
Misc/NEWS
+2
-0
No files found.
Lib/test/test_errno.py
View file @
b7ec8e5a
...
@@ -4,7 +4,8 @@
...
@@ -4,7 +4,8 @@
"""
"""
import
errno
import
errno
from
test.test_support
import
verbose
from
test
import
test_support
import
unittest
errors
=
[
'E2BIG'
,
'EACCES'
,
'EADDRINUSE'
,
'EADDRNOTAVAIL'
,
'EADV'
,
errors
=
[
'E2BIG'
,
'EACCES'
,
'EADDRINUSE'
,
'EADDRNOTAVAIL'
,
'EADV'
,
'EAFNOSUPPORT'
,
'EAGAIN'
,
'EALREADY'
,
'EBADE'
,
'EBADF'
,
'EAFNOSUPPORT'
,
'EAGAIN'
,
'EALREADY'
,
'EBADE'
,
'EBADF'
,
...
@@ -33,17 +34,33 @@ errors = ['E2BIG', 'EACCES', 'EADDRINUSE', 'EADDRNOTAVAIL', 'EADV',
...
@@ -33,17 +34,33 @@ errors = ['E2BIG', 'EACCES', 'EADDRINUSE', 'EADDRNOTAVAIL', 'EADV',
'ETIMEDOUT'
,
'ETOOMANYREFS'
,
'ETXTBSY'
,
'EUNATCH'
,
'ETIMEDOUT'
,
'ETOOMANYREFS'
,
'ETXTBSY'
,
'EUNATCH'
,
'EUSERS'
,
'EWOULDBLOCK'
,
'EXDEV'
,
'EXFULL'
]
'EUSERS'
,
'EWOULDBLOCK'
,
'EXDEV'
,
'EXFULL'
]
#
# This is a wee bit bogus since the module only conditionally adds
class
ErrnoAttributeTests
(
unittest
.
TestCase
):
# errno constants if they have been defined by errno.h However, this
# test seems to work on SGI, Sparc & intel Solaris, and linux.
def
test_for_improper_attributes
(
self
):
#
# No unexpected attributes should be on the module.
for
error
in
errors
:
errors_set
=
set
(
errors
)
try
:
for
attribute
in
errno
.
__dict__
.
iterkeys
():
a
=
getattr
(
errno
,
error
)
if
attribute
.
isupper
():
except
AttributeError
:
self
.
assert_
(
attribute
in
errors_set
)
if
verbose
:
print
'%s: not found'
%
error
def
test_using_errorcode
(
self
):
else
:
# Every key value in errno.errorcode should be on the module.
if
verbose
:
for
value
in
errno
.
errorcode
.
itervalues
():
print
'%s: %d'
%
(
error
,
a
)
self
.
assert_
(
hasattr
(
errno
,
value
))
class
ErrorcodeTests
(
unittest
.
TestCase
):
def
test_attributes_in_errorcode
(
self
):
for
attribute
in
errno
.
__dict__
.
iterkeys
():
if
attribute
.
isupper
():
self
.
assert_
(
getattr
(
errno
,
attribute
)
in
errno
.
errorcode
)
def
test_main
():
test_support
.
run_unittest
(
ErrnoAttributeTests
,
ErrorcodeTests
)
if
__name__
==
'__main__'
:
test_main
()
Misc/NEWS
View file @
b7ec8e5a
...
@@ -78,6 +78,8 @@ Library
...
@@ -78,6 +78,8 @@ Library
Tests
Tests
-----
-----
- Rewrite test_errno to use unittest and no longer be a no-op.
- GHOP 234: Convert test_extcall to doctest.
- GHOP 234: Convert test_extcall to doctest.
- GHOP 290: Convert test_dbm and test_dummy_threading to unittest.
- GHOP 290: Convert test_dbm and test_dummy_threading to unittest.
...
...
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