Skip to content

Commit

Permalink
Isolate the attack tests with setUp and tearDown methods
Browse files Browse the repository at this point in the history
  • Loading branch information
shreve committed Feb 8, 2023
1 parent c7a9470 commit a011765
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion IPython/core/tests/test_interactiveshell.py
Expand Up @@ -1112,11 +1112,17 @@ def foo(*args, **kwargs):
ip.Completer.custom_matchers.pop()


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

def setUp(self):
self.orig_showtraceback = interactiveshell.InteractiveShell.showtraceback

def tearDown(self):
interactiveshell.InteractiveShell.showtraceback = self.orig_showtraceback

def test_set_show_tracebacks_none(self):
"""Test the case of the client setting showtracebacks to None"""

Expand Down

0 comments on commit a011765

Please sign in to comment.