Commit 045e0916 by Ned Batchelder

Change how we import codejail into the tests.

parent 5fb5fa06
...@@ -5,7 +5,7 @@ import textwrap ...@@ -5,7 +5,7 @@ import textwrap
import unittest import unittest
from nose.plugins.skip import SkipTest from nose.plugins.skip import SkipTest
from codejail.safe_exec import safe_exec, not_safe_exec, SafeExecException from codejail import safe_exec
class SafeExecTests(unittest.TestCase): class SafeExecTests(unittest.TestCase):
...@@ -71,7 +71,7 @@ class SafeExecTests(unittest.TestCase): ...@@ -71,7 +71,7 @@ class SafeExecTests(unittest.TestCase):
def test_raising_exceptions(self): def test_raising_exceptions(self):
globs = {} globs = {}
with self.assertRaises(SafeExecException) as what_happened: with self.assertRaises(safe_exec.SafeExecException) as what_happened:
self.safe_exec(textwrap.dedent("""\ self.safe_exec(textwrap.dedent("""\
raise ValueError("That's not how you pour soup!") raise ValueError("That's not how you pour soup!")
"""), globs) """), globs)
...@@ -85,7 +85,7 @@ class TestSafeExec(SafeExecTests, unittest.TestCase): ...@@ -85,7 +85,7 @@ class TestSafeExec(SafeExecTests, unittest.TestCase):
__test__ = True __test__ = True
def safe_exec(self, *args, **kwargs): def safe_exec(self, *args, **kwargs):
safe_exec(*args, **kwargs) safe_exec.safe_exec(*args, **kwargs)
class TestNotSafeExec(SafeExecTests, unittest.TestCase): class TestNotSafeExec(SafeExecTests, unittest.TestCase):
...@@ -100,4 +100,4 @@ class TestNotSafeExec(SafeExecTests, unittest.TestCase): ...@@ -100,4 +100,4 @@ class TestNotSafeExec(SafeExecTests, unittest.TestCase):
raise SkipTest raise SkipTest
def safe_exec(self, *args, **kwargs): def safe_exec(self, *args, **kwargs):
not_safe_exec(*args, **kwargs) safe_exec.not_safe_exec(*args, **kwargs)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment