Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
codejail
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
codejail
Commits
5eed1d1b
Commit
5eed1d1b
authored
Feb 26, 2013
by
Ned Batchelder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A unit test that demonstrates the problem we're having with some sandboxed code.
parent
92874c20
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
+12
-0
codejail/tests/test_safe_exec.py
+12
-0
No files found.
codejail/tests/test_safe_exec.py
View file @
5eed1d1b
"""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."""
...
...
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