aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Joe Banks <[email protected]>2025-10-11 02:40:42 +0100
committerGravatar Joe Banks <[email protected]>2025-10-14 00:08:02 +0100
commit1ed5b1b9d730d60d74b7f4801cb620428ccebd5f (patch)
treeb6d466e016510acff365f56eb811dd8e635a7d07
parentAdd new build steps for 3.14.0 with JIT (diff)
Add integration test for validating JIT builds of Python
-rw-r--r--tests/test_integration.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/test_integration.py b/tests/test_integration.py
index b3c1707..c15638a 100644
--- a/tests/test_integration.py
+++ b/tests/test_integration.py
@@ -103,6 +103,33 @@ class IntegrationTests(unittest.TestCase):
self.assertEqual(status, 200)
self.assertEqual(json.loads(response)["stdout"], expected)
+ def test_jit_status(self):
+ """Tests that JIT builds have the JIT available and enabled."""
+ with run_gunicorn():
+ get_jit_status = {"input": "import sys; print(sys._jit.is_enabled())"}
+
+ # This test will only work on tests where the sys._jit namespace exists.
+ #
+ # The namespace was added in 3.14 but is not guaranteed to be there for other
+ # implementations of Python, see https://docs.python.org/3/library/sys.html#sys._jit
+ # for full information.
+ #
+ # For now, the two below test cases are guaranteed to have the sys._jit module available
+ # and (if compiled correctly) should return the below values.
+ cases = [
+ ("3.14", "False\n"),
+ ("3.14j", "True\n"),
+ ]
+ for version, expected in cases:
+ with self.subTest(version=version, expected=expected):
+ payload = {
+ "executable_path": f"/snekbin/python/{version}/bin/python",
+ **get_jit_status,
+ }
+ response, status = snekbox_request(payload)
+ self.assertEqual(status, 200)
+ self.assertEqual(json.loads(response)["stdout"], expected)
+
def invalid_executable_paths(self):
"""Test that passing invalid executable paths result in no code execution."""
with run_gunicorn():