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
4354ba3f
Commit
4354ba3f
authored
Aug 03, 2004
by
Fred Drake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avoid fragility: make sure POSIXLY_CORRECT is completely controlled
for the tests, and restored properly when done
parent
34fba3b4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletion
+10
-1
Lib/test/test_getopt.py
Lib/test/test_getopt.py
+10
-1
No files found.
Lib/test/test_getopt.py
View file @
4354ba3f
...
...
@@ -16,6 +16,10 @@ def expectException(teststr, expected, failure=AssertionError):
else
:
raise
failure
old_posixly_correct
=
os
.
environ
.
get
(
"POSIXLY_CORRECT"
)
if
old_posixly_correct
is
not
None
:
del
os
.
environ
[
"POSIXLY_CORRECT"
]
if
verbose
:
print
'Running tests on getopt.short_has_arg'
verify
(
getopt
.
short_has_arg
(
'a'
,
'a:'
))
...
...
@@ -124,7 +128,12 @@ os.environ["POSIXLY_CORRECT"] = "1"
opts
,
args
=
getopt
.
gnu_getopt
(
cmdline
,
'ab:'
,
[
'alpha'
,
'beta='
])
verify
(
opts
==
[(
'-a'
,
''
)])
verify
(
args
==
[
'arg1'
,
'-b'
,
'1'
,
'--alpha'
,
'--beta=2'
])
del
os
.
environ
[
"POSIXLY_CORRECT"
]
if
old_posixly_correct
is
None
:
del
os
.
environ
[
"POSIXLY_CORRECT"
]
else
:
os
.
environ
[
"POSIXLY_CORRECT"
]
=
old_posixly_correct
#------------------------------------------------------------------------------
...
...
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