Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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
edx-platform
Commits
1473fe37
Commit
1473fe37
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
d9df65ee
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
+12
-0
common/lib/codejail/codejail/tests/test_safe_exec.py
+12
-0
No files found.
common/lib/codejail/codejail/tests/test_safe_exec.py
View file @
1473fe37
"""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