8000 Isolate the attack tests with setUp and tearDown methods · ipython/ipython@a011765 · GitHub
[go: up one dir, main page]

Skip to content

Commit a011765

Browse files
committed
Isolate the attack tests with setUp and tearDown methods
1 parent c7a9470 commit a011765

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

IPython/core/tests/test_interactiveshell.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1112,11 +1112,17 @@ def foo(*args, 9BAA **kwargs):
11121112
ip.Completer.custom_matchers.pop()
11131113

11141114

1115-
class TestShowTracebacksAttack(unittest.TestCase):
1115+
class TestShowTracebackAttack(unittest.TestCase):
11161116
"""Test that the interactive shell is resilient against the client attack of
11171117
manipulating the showtracebacks method. These attacks shouldn't result in an
11181118
unhandled exception in the kernel."""
11191119

1120+
def setUp(self):
1121+
self.orig_showtraceback = interactiveshell.InteractiveShell.showtraceback
1122+
1123+
def tearDown(self):
1124+
interactiveshell.InteractiveShell.showtraceback = self.orig_showtraceback
1125+
11201126
def test_set_show_tracebacks_none(self):
11211127
"""Test the case of the client setting showtracebacks to None"""
11221128

0 commit comments

Comments
 (0)
0