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
850b2be6
Commit
850b2be6
authored
Oct 29, 2006
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert test_nis to unittest.
parent
eecce795
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
37 deletions
+37
-37
Lib/test/output/test_nis
Lib/test/output/test_nis
+0
-2
Lib/test/test_nis.py
Lib/test/test_nis.py
+37
-35
No files found.
Lib/test/output/test_nis
deleted
100644 → 0
View file @
eecce795
test_nis
nis.maps()
Lib/test/test_nis.py
View file @
850b2be6
from
test.test_support
import
verbose
,
TestFailed
,
TestSkipped
from
test.test_support
import
verbose
,
run_unittest
import
unittest
import
nis
print
'nis.maps()'
try
:
class
NisTests
(
unittest
.
TestCase
):
def
test_maps
(
self
):
try
:
maps
=
nis
.
maps
()
except
nis
.
error
,
msg
:
except
nis
.
error
,
msg
:
# NIS is probably not active, so this test isn't useful
if
verbose
:
raise
TestFailed
,
msg
# only do this if running under the regression suite
raise
TestSkipped
,
msg
try
:
self
.
fail
(
"(failing because of verbose mode) %s"
%
msg
)
return
try
:
# On some systems, this map is only accessible to the
# super user
maps
.
remove
(
"passwd.adjunct.byname"
)
except
ValueError
:
except
ValueError
:
pass
done
=
0
for
nismap
in
maps
:
if
verbose
:
print
nismap
done
=
0
for
nismap
in
maps
:
mapping
=
nis
.
cat
(
nismap
)
for
k
,
v
in
mapping
.
items
():
if
verbose
:
print
' '
,
k
,
v
if
not
k
:
continue
if
nis
.
match
(
k
,
nismap
)
!=
v
:
print
"NIS match failed for key `%s' in map `%s'"
%
(
k
,
nismap
)
self
.
fail
(
"NIS match failed for key `%s' in map `%s'"
%
(
k
,
nismap
)
)
else
:
# just test the one key, otherwise this test could take a
# very long time
...
...
@@ -37,3 +33,9 @@ for nismap in maps:
break
if
done
:
break
def
test_main
():
run_unittest
(
NisTests
)
if
__name__
==
'__main__'
:
test_main
()
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