aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2024-10-07 18:45:24 +0100
committerGravatar Chris Lovering <[email protected]>2024-10-07 19:51:21 +0100
commitd7f57ee67aba28dbd75bf687d32048159059697e (patch)
tree237a5225ab5148b492ca09e942f2416e8fb5f2f0
parentBump 3.12 to 3.12.7 from 3.12.5 (diff)
Add test to ensure free threaded versions have GIL disabled
-rw-r--r--tests/test_integration.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test_integration.py b/tests/test_integration.py
index 0d8f700..b4476cd 100644
--- a/tests/test_integration.py
+++ b/tests/test_integration.py
@@ -83,6 +83,25 @@ class IntegrationTests(unittest.TestCase):
self.assertEqual(status, 200)
self.assertEqual(json.loads(response)["stdout"], expected)
+ def test_gil_status(self):
+ """Test no-gil builds actually don't have a gil."""
+ with run_gunicorn():
+ get_gil_status = {
+ "input": "import sysconfig; print(sysconfig.get_config_var('Py_GIL_DISABLED'))"
+ }
+ cases = [
+ ("3.13", "0\n"),
+ ("3.13t", "1\n"),
+ ]
+ for version, expected in cases:
+ with self.subTest(version=version, expected=expected):
+ response, status = snekbox_request(
+ get_gil_status
+ | {"executable_path": f"/snekbin/python/{version}/bin/python"}
+ )
+ 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():