From 4f89a32bb182a64c309627c996ae446ef0879ab1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mois=C3=A9s=20Gonz=C3=A1lez?= Date: Fri, 26 Apr 2024 09:53:59 -0400 Subject: [PATCH] ci: add tests for python3.11 and python3.12. Fix some tests --- .github/workflows/ci.yml | 14 +++++++++----- codejailservice/tests/test_code_exec_service.py | 8 ++++---- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 505b292..cb4718d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,15 +12,19 @@ on: jobs: build: - + name: tests runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.8", "3.11", "3.12"] steps: - - uses: actions/checkout@v2 - - name: Set up Python 3.8 - uses: actions/setup-python@v2 + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 with: - python-version: 3.8 + python-version: ${{ matrix.python-version }} - name: Install dependencies run: | make requirements diff --git a/codejailservice/tests/test_code_exec_service.py b/codejailservice/tests/test_code_exec_service.py index dbd1017..de7b9bc 100644 --- a/codejailservice/tests/test_code_exec_service.py +++ b/codejailservice/tests/test_code_exec_service.py @@ -150,8 +150,8 @@ def test_unsafe_code_exec_failure(self, import_code_jail_safe_exec): data={"payload": json.dumps(payload)}, ) self.assertEqual(200, response.status_code) - self.assertIn(expected_result.pop("emsg"), response.json["emsg"]) - self.assertDictContainsSubset(expected_result, response.json) + self.assertEqual(expected_result['emsg'], response.json["emsg"]) + self.assertEqual(expected_result['globals_dict'], response.json["globals_dict"]) @mock.patch("codejailservice.routes.code_exec_service.import_code_jail_safe_exec") def test_safe_code_exec_failure(self, import_code_jail_safe_exec): @@ -190,5 +190,5 @@ def test_safe_code_exec_failure(self, import_code_jail_safe_exec): data={"payload": json.dumps(payload)}, ) self.assertEqual(200, response.status_code) - self.assertIn(expected_result.pop("emsg"), response.json["emsg"]) - self.assertDictContainsSubset(expected_result, response.json) + self.assertEqual(expected_result['emsg'], response.json["emsg"]) + self.assertEqual(expected_result['globals_dict'], response.json["globals_dict"])