aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_integration.py3
-rw-r--r--tests/test_nsjail.py8
2 files changed, 8 insertions, 3 deletions
diff --git a/tests/test_integration.py b/tests/test_integration.py
index 91b01e6..aa21a2d 100644
--- a/tests/test_integration.py
+++ b/tests/test_integration.py
@@ -7,6 +7,8 @@ from textwrap import dedent
from tests.gunicorn_utils import run_gunicorn
+from scripts.python_version import MAIN_VERSION
+
def b64encode_code(data: str):
data = dedent(data).strip()
@@ -95,6 +97,7 @@ class IntegrationTests(unittest.TestCase):
expected = {
"stdout": "hello\n",
"returncode": 0,
+ "version": MAIN_VERSION.display_name,
"files": [
{
"path": "dir/test2.txt",
diff --git a/tests/test_nsjail.py b/tests/test_nsjail.py
index 456046b..d59a6ce 100644
--- a/tests/test_nsjail.py
+++ b/tests/test_nsjail.py
@@ -9,6 +9,7 @@ from itertools import product
from pathlib import Path
from textwrap import dedent
+from scripts.python_version import MAIN_VERSION
from snekbox.filesystem import Size
from snekbox.nsjail import NsJail
from snekbox.snekio import FileAttachment
@@ -24,11 +25,11 @@ class NsJailTests(unittest.TestCase):
self.logger.setLevel(logging.WARNING)
def eval_code(self, code: str):
- return self.nsjail.python3(["-c", code])
+ return self.nsjail.python3(["-c", code], MAIN_VERSION)
def eval_file(self, code: str, name: str = "test.py", **kwargs):
file = FileAttachment(name, code.encode())
- return self.nsjail.python3([name], [file], **kwargs)
+ return self.nsjail.python3([name], MAIN_VERSION, [file], **kwargs)
def test_print_returns_0(self):
for fn in (self.eval_code, self.eval_file):
@@ -64,7 +65,7 @@ class NsJailTests(unittest.TestCase):
FileAttachment("lib.py", "x = 'hello'".encode()),
]
- result = self.nsjail.python3(["main.py"], files)
+ result = self.nsjail.python3(["main.py"], MAIN_VERSION, files)
self.assertEqual(result.returncode, 0)
self.assertEqual(result.stdout, "hello\n")
self.assertEqual(result.stderr, None)
@@ -231,6 +232,7 @@ class NsJailTests(unittest.TestCase):
"""Test errors during file write."""
result = self.nsjail.python3(
[""],
+ MAIN_VERSION,
[
FileAttachment("dir/test.txt", b"abc"),
FileAttachment("dir", b"xyz"),