From 229994d5e984bb30865c18922d45b303feb3a50c Mon Sep 17 00:00:00 2001 From: Kristoffer Andersson Date: Fri, 22 Mar 2024 15:46:17 +0100 Subject: [PATCH 1/2] ci: only test for python >=3.9 --- .github/workflows/check.yml | 8 ++++---- .github/workflows/release.yml | 6 +++--- .github/workflows/test.yml | 7 +++---- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 445def3..ba3bca2 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -11,7 +11,7 @@ permissions: contents: read env: - MINIMUM_PYTHON_VERSION: "3.8" + MINIMUM_PYTHON_VERSION: "3.9" # If new code is pushed to a PR branch, then cancel in progress workflows for that PR. Ensures that # we don't waste CI time, and returns results quicker https://github.com/jonhoo/rust-ci-conf/pull/5 @@ -22,7 +22,7 @@ concurrency: jobs: fmt: runs-on: ubuntu-latest - name: ubuntu / 3.8 / fmt + name: ubuntu / 3.9 / fmt steps: - uses: actions/checkout@v4 with: @@ -49,7 +49,7 @@ jobs: run: make check-fmt lint: runs-on: ubuntu-latest - name: ubuntu / 3.8 / lint + name: ubuntu / 3.9 / lint steps: - uses: actions/checkout@v4 with: @@ -72,7 +72,7 @@ jobs: run: make lint type-check: runs-on: ubuntu-latest - name: ubuntu / 3.8 / type-check + name: ubuntu / 3.9 / type-check steps: - uses: actions/checkout@v4 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 33da080..f260868 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,13 +16,13 @@ permissions: contents: read env: - MINIMUM_PYTHON_VERSION: "3.8" + MINIMUM_PYTHON_VERSION: "3.9" jobs: build: # This action builds distribution files for upload to PyPI - name: ubuntu / 3.8 / build + name: ubuntu / 3.9 / build runs-on: ubuntu-latest steps: #---------------------------------------------- @@ -60,7 +60,7 @@ jobs: # This action runs the test suite on the built artifact in the `build` action. # The default is to run this in ubuntu, macos and windows - name: ${{ matrix.os }} / 3.8 / test built artifact + name: ${{ matrix.os }} / 3.9 / test built artifact needs: [build] strategy: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7436f5f..6de35c4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,7 +15,7 @@ permissions: contents: read env: - MINIMUM_PYTHON_VERSION: "3.8" + MINIMUM_PYTHON_VERSION: "3.9" jobs: @@ -32,7 +32,6 @@ jobs: os: [ubuntu] python-version: # remove the unused versions - - "3.8" - "3.9" - "3.10" - "3.11" @@ -90,7 +89,7 @@ jobs: # This requires the secret `CODECOV_TOKEN` be set as secret on GitHub, both for # Actions and Dependabot - name: "${{ matrix.os }} / 3.8 / ${{ matrix.json-lib }} / doctest" + name: "${{ matrix.os }} / 3.9 / ${{ matrix.json-lib }} / doctest" strategy: max-parallel: 4 fail-fast: false @@ -152,7 +151,7 @@ jobs: # runs-on: ubuntu-latest - name: ubuntu / 3.8 / minimal-versions + name: ubuntu / 3.9 / minimal-versions steps: - uses: actions/checkout@v4 with: From 99f60d58a8bccaad8a4f9cacb00763bffe30331d Mon Sep 17 00:00:00 2001 From: Kristoffer Andersson Date: Fri, 22 Mar 2024 17:20:47 +0100 Subject: [PATCH 2/2] test: fix type error --- tests/test_json_streams_init.py | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/tests/test_json_streams_init.py b/tests/test_json_streams_init.py index 368380f..213f211 100644 --- a/tests/test_json_streams_init.py +++ b/tests/test_json_streams_init.py @@ -25,9 +25,10 @@ ], ) def test_dump_to_file_json(file_name, json_format, expected_iter): - with mock.patch("json_arrays.json_iter.dump_to_file") as json_iter_mock, mock.patch( - "json_arrays.jsonl_iter.dump_to_file" - ) as jsonl_iter_mock: + with ( + mock.patch("json_arrays.json_iter.dump_to_file") as json_iter_mock, + mock.patch("json_arrays.jsonl_iter.dump_to_file") as jsonl_iter_mock, + ): in_iter = None json_arrays.dump_to_file(in_iter, file_name, json_format=json_format) expected_call = [mock.call(in_iter, file_name, file_mode="wb")] @@ -57,9 +58,10 @@ def test_dump_to_file_json(file_name, json_format, expected_iter): ], ) def test_sink_from_file_json(file_name, json_format, expected_iter): - with mock.patch("json_arrays.json_iter.sink_from_file") as json_iter_mock, mock.patch( - "json_arrays.jsonl_iter.sink_from_file" - ) as jsonl_iter_mock: + with ( + mock.patch("json_arrays.json_iter.sink_from_file") as json_iter_mock, + mock.patch("json_arrays.jsonl_iter.sink_from_file") as jsonl_iter_mock, + ): json_arrays.sink_from_file(file_name, json_format=json_format) expected_call = [mock.call(file_name, file_mode="wb")] if expected_iter == "json_iter": @@ -88,9 +90,10 @@ def test_sink_from_file_json(file_name, json_format, expected_iter): ], ) def test_load_from_file_json(file_name, json_format, expected_iter): - with mock.patch("json_arrays.json_iter.load_from_file") as json_iter_mock, mock.patch( - "json_arrays.jsonl_iter.load_from_file" - ) as jsonl_iter_mock: + with ( + mock.patch("json_arrays.json_iter.load_from_file") as json_iter_mock, + mock.patch("json_arrays.jsonl_iter.load_from_file") as jsonl_iter_mock, + ): for _ in json_arrays.load_from_file(file_name, json_format=json_format): pass expected_call = mock.call(file_name, file_mode="rb") @@ -145,7 +148,8 @@ def test_sink_int_memoryio(data, facit, json_format): def test_load_from_file_fails_without_file_name() -> None: try: - next(json_arrays.load_from_file(None, use_stdin_as_default=False)) + for _ in json_arrays.load_from_file(None, use_stdin_as_default=False): + pass except ValueError as exc: assert str(exc) == "You must give a FILENAME or USE_STDIN_AS_DEFAULT=`True`"