A unit test that demonstrates the problem we're having with some sandboxed code.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"""Test safe_exec.py"""
|
||||
|
||||
import os.path
|
||||
import textwrap
|
||||
import unittest
|
||||
from nose.plugins.skip import SkipTest
|
||||
|
||||
@@ -42,6 +43,17 @@ class SafeExecTests(object):
|
||||
)
|
||||
self.assertEqual(l['a'], 42)
|
||||
|
||||
def test_functions_calling_each_other(self):
|
||||
g, l = {}, {}
|
||||
self.safe_exec(textwrap.dedent("""\
|
||||
def f():
|
||||
return 1723
|
||||
def g():
|
||||
return f()
|
||||
x = g()
|
||||
"""), g, l)
|
||||
self.assertEqual(l['x'], 1723)
|
||||
|
||||
|
||||
class TestSafeExec(SafeExecTests, unittest.TestCase):
|
||||
"""Run SafeExecTests, with the real safe_exec."""
|
||||
|
||||
Reference in New Issue
Block a user