Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
47a11f25
Commit
47a11f25
authored
Nov 22, 2005
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Suppress expected DeprecationWarning output in test.
parent
b27c3596
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
1 deletion
+27
-1
lib/python/Products/PythonScripts/tests/testPythonScript.py
lib/python/Products/PythonScripts/tests/testPythonScript.py
+27
-1
No files found.
lib/python/Products/PythonScripts/tests/testPythonScript.py
View file @
47a11f25
...
@@ -25,6 +25,30 @@ else:
...
@@ -25,6 +25,30 @@ else:
if
not
here
:
if
not
here
:
here
=
os
.
getcwd
()
here
=
os
.
getcwd
()
class
WarningInterceptor
:
_old_stderr
=
None
_our_stderr_stream
=
None
def
_trap_warning_output
(
self
):
if
self
.
_old_stderr
is
not
None
:
return
import
sys
from
StringIO
import
StringIO
self
.
_old_stderr
=
sys
.
stderr
self
.
_our_stderr_stream
=
sys
.
stderr
=
StringIO
()
def
_free_warning_output
(
self
):
if
self
.
_old_stderr
is
None
:
return
import
sys
sys
.
stderr
=
self
.
_old_stderr
# Test Classes
# Test Classes
def
readf
(
name
):
def
readf
(
name
):
...
@@ -219,7 +243,7 @@ class TestPythonScriptErrors(PythonScriptTestBase):
...
@@ -219,7 +243,7 @@ class TestPythonScriptErrors(PythonScriptTestBase):
f
=
self
.
_newPS
(
defn
+
"
\
n
"
+
asn
%
name
)
f
=
self
.
_newPS
(
defn
+
"
\
n
"
+
asn
%
name
)
self
.
assertRaises
(
TypeError
,
f
)
self
.
assertRaises
(
TypeError
,
f
)
class
TestPythonScriptGlobals
(
PythonScriptTestBase
):
class
TestPythonScriptGlobals
(
PythonScriptTestBase
,
WarningInterceptor
):
def
_exec
(
self
,
script
,
bound_names
=
None
,
args
=
None
,
kws
=
None
):
def
_exec
(
self
,
script
,
bound_names
=
None
,
args
=
None
,
kws
=
None
):
if
args
is
None
:
if
args
is
None
:
args
=
()
args
=
()
...
@@ -241,8 +265,10 @@ class TestPythonScriptGlobals(PythonScriptTestBase):
...
@@ -241,8 +265,10 @@ class TestPythonScriptGlobals(PythonScriptTestBase):
def
test_filepath
(
self
):
def
test_filepath
(
self
):
# This test is meant to raise a deprecation warning.
# This test is meant to raise a deprecation warning.
# It used to fail mysteriously instead.
# It used to fail mysteriously instead.
self
.
_trap_warning_output
()
f
=
self
.
_filePS
(
'filepath'
)
f
=
self
.
_filePS
(
'filepath'
)
self
.
assertEqual
(
f
(),
[
0
])
self
.
assertEqual
(
f
(),
[
0
])
self
.
_free_warning_output
()
def
test_suite
():
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
=
unittest
.
TestSuite
()
...
...
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