From 0cf67990bb8760e5a40d7150e43a2dd597b18c2a Mon Sep 17 00:00:00 2001 From: helix_xx <630824252@qq.com> Date: Sat, 6 Apr 2024 01:19:15 +0800 Subject: [PATCH 1/6] only test on python-version 3.12 --- .github/workflows/unittest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index e3e7e12..2c9d160 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -18,7 +18,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.12"] os: [ubuntu-latest] include: - { python-version: "pypy-3.10", os: windows-latest } From f0fb7232694bcb991a957c3a2c8645ba8365ec9f Mon Sep 17 00:00:00 2001 From: helix_xx <630824252@qq.com> Date: Sat, 6 Apr 2024 01:22:46 +0800 Subject: [PATCH 2/6] uncomment memoryError test, since github workflow time limit is cancled. --- test/encode_test.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/test/encode_test.py b/test/encode_test.py index b410e5a..6da9a84 100644 --- a/test/encode_test.py +++ b/test/encode_test.py @@ -22,16 +22,15 @@ class A: with self.assertRaises(TypeError): cjson.dumps(case) - # TODO uncomment this later - # # MemoryError - # test_cases = [ - # [1] * 2147483648 - # ] - - # for case in test_cases: - # with self.subTest(msg=f'encoding_fail_test(case={case})'): - # with self.assertRaises(MemoryError): - # cjson.dumps(case) + # MemoryError + test_cases = [ + [1] * 2147483648 + ] + + for case in test_cases: + with self.subTest(msg=f'encoding_fail_test(case={case})'): + with self.assertRaises(MemoryError): + cjson.dumps(case) def test_default(self): import cjson From 96def792565cee1f4a7981024af9fb8b45da43a1 Mon Sep 17 00:00:00 2001 From: helix_xx <630824252@qq.com> Date: Sat, 6 Apr 2024 01:38:50 +0800 Subject: [PATCH 3/6] run benchmark only on python-version 3.12 --- .github/workflows/unittest.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index 2c9d160..7b4bb38 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -18,7 +18,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.12"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] os: [ubuntu-latest] include: - { python-version: "pypy-3.10", os: windows-latest } @@ -44,4 +44,8 @@ jobs: - name: run tests id: tests run: | + if [[ "${{ matrix.python-version }}" == "3.12" ]]; then + python test/all_test.py + fi python test/all_test.py --ignore benchmark + From 7e7dfbcfbbfc4b76f2c7145be33de2bc1d156ab0 Mon Sep 17 00:00:00 2001 From: helix_xx <630824252@qq.com> Date: Sat, 6 Apr 2024 02:05:32 +0800 Subject: [PATCH 4/6] run benchmark on python-version 3.12 --- .github/workflows/unittest.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index 7b4bb38..dfd7c31 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -44,8 +44,9 @@ jobs: - name: run tests id: tests run: | - if [[ "${{ matrix.python-version }}" == "3.12" ]]; then + if [ "${{ matrix.python-version }}" = "3.12" ]; then python test/all_test.py + else + python test/all_test.py --ignore benchmark fi - python test/all_test.py --ignore benchmark From d5382719f75df00bc6050c000413b2085e0bb9b6 Mon Sep 17 00:00:00 2001 From: helix_xx <630824252@qq.com> Date: Sat, 6 Apr 2024 02:22:31 +0800 Subject: [PATCH 5/6] run benchmark on python-version 3.12 --- .github/workflows/unittest.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index dfd7c31..3b00a32 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -41,12 +41,15 @@ jobs: run: | python -m pip install . - - name: run tests + - name: run tests with benchmark + if: ${{ matrix.python-version == '3.12' }} id: tests run: | - if [ "${{ matrix.python-version }}" = "3.12" ]; then python test/all_test.py - else - python test/all_test.py --ignore benchmark - fi + + - name: run tests without benchmark + if: ${{ matrix.python-version != '3.12' }} + id: tests_no_benchmark + run: | + python test/all_test.py --no-benchmark From 9bdbbd25f4f8f342c3933eeb72ecc8d66ae4d0c7 Mon Sep 17 00:00:00 2001 From: helix_xx <630824252@qq.com> Date: Sat, 6 Apr 2024 02:25:01 +0800 Subject: [PATCH 6/6] brnchmark on python-version 3.12 --- .github/workflows/unittest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index 3b00a32..b7b30ba 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -51,5 +51,5 @@ jobs: if: ${{ matrix.python-version != '3.12' }} id: tests_no_benchmark run: | - python test/all_test.py --no-benchmark + python test/all_test.py --ignore benchmark