Skip to content
This repository has been archived by the owner on May 25, 2024. It is now read-only.

test: memory test & benchmark on 3.12 #3

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +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: |
python test/all_test.py --ignore benchmark
python test/all_test.py

- name: run tests without benchmark
if: ${{ matrix.python-version != '3.12' }}
id: tests_no_benchmark
run: |
python test/all_test.py --ignore benchmark

19 changes: 9 additions & 10 deletions test/encode_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading