diff --git a/.github/workflows/test_client_macos_nightlies.yml b/.github/workflows/test_client_macos_nightlies.yml index 6d387598..df3dcb2d 100644 --- a/.github/workflows/test_client_macos_nightlies.yml +++ b/.github/workflows/test_client_macos_nightlies.yml @@ -35,4 +35,4 @@ jobs: env: SIMVUE_URL: ${{ secrets.SIMVUE_NIGHTLY_URL }} SIMVUE_TOKEN: ${{ secrets.SIMVUE_NIGHTLY_TOKEN }} - run: python -m pytest tests/ -m 'not scenario' + run: python -m pytest tests/ -m 'not scenario' -c /dev/null -o cache_dir=${GITHUB_WORKSPACE}/.pytest-cache diff --git a/.github/workflows/test_client_ubuntu.yml b/.github/workflows/test_client_ubuntu.yml index a20de2dd..cd87d224 100644 --- a/.github/workflows/test_client_ubuntu.yml +++ b/.github/workflows/test_client_ubuntu.yml @@ -39,7 +39,10 @@ jobs: env: SIMVUE_URL: ${{ secrets.SIMVUE_URL }} SIMVUE_TOKEN: ${{ secrets.SIMVUE_TOKEN }} - run: python -m pytest tests/unit/ -x -m online -c /dev/null -p no:warnings -n 0 -v + run: >- + python -m pytest tests/unit/ -x + -m online -c /dev/null -p no:warnings + -n 0 -v -o cache_dir=${GITHUB_WORKSPACE}/.pytest-cache offline_unit_tests: runs-on: ubuntu-latest timeout-minutes: 40 @@ -61,7 +64,10 @@ jobs: env: SIMVUE_URL: ${{ secrets.SIMVUE_URL }} SIMVUE_TOKEN: ${{ secrets.SIMVUE_TOKEN }} - run: python -m pytest tests/unit/ -x -m offline -c /dev/null -p no:warnings -n 0 -v + run: >- + python -m pytest tests/unit/ -x + -m offline -c /dev/null -p no:warnings + -n 0 -v -o cache_dir=${GITHUB_WORKSPACE}/.pytest-cache online_functional_tests: runs-on: ubuntu-latest timeout-minutes: 40 @@ -83,7 +89,10 @@ jobs: env: SIMVUE_URL: ${{ secrets.SIMVUE_URL }} SIMVUE_TOKEN: ${{ secrets.SIMVUE_TOKEN }} - run: python -m pytest tests/functional/ -x -m online -c /dev/null -p no:warnings -n 0 -v + run: >- + python -m pytest tests/functional/ -x + -m online -c /dev/null -p no:warnings + -n 0 -v -o cache_dir=${GITHUB_WORKSPACE}/.pytest-cache offline_functional_tests: runs-on: ubuntu-latest timeout-minutes: 40 @@ -105,7 +114,10 @@ jobs: env: SIMVUE_URL: ${{ secrets.SIMVUE_URL }} SIMVUE_TOKEN: ${{ secrets.SIMVUE_TOKEN }} - run: python -m pytest tests/functional/ -x -m offline -c /dev/null -p no:warnings -n 0 -v + run: >- + python -m pytest tests/functional/ -x + -m offline -c /dev/null -p no:warnings + -n 0 -v -o cache_dir=${GITHUB_WORKSPACE}/.pytest-cache other_unit_tests: runs-on: ubuntu-latest timeout-minutes: 40 @@ -127,7 +139,11 @@ jobs: env: SIMVUE_URL: ${{ secrets.SIMVUE_URL }} SIMVUE_TOKEN: ${{ secrets.SIMVUE_TOKEN }} - run: python -m pytest tests/unit/ -x -m 'not offline' -m 'not online' -m 'not scenario' -c /dev/null -p no:warnings -n 0 -v + run: >- + python -m pytest tests/unit/ -x + -m 'not offline' -m 'not online' + -m 'not scenario' -c /dev/null + -p no:warnings -n 0 -v -o cache_dir=${GITHUB_WORKSPACE}/.pytest-cache other_functional_tests: runs-on: ubuntu-latest timeout-minutes: 40 @@ -149,4 +165,8 @@ jobs: env: SIMVUE_URL: ${{ secrets.SIMVUE_URL }} SIMVUE_TOKEN: ${{ secrets.SIMVUE_TOKEN }} - run: python -m pytest tests/functional/ -x -m 'not offline' -m 'not online' -m 'not scenario' -c /dev/null -p no:warnings -n 0 -v + run: >- + python -m pytest tests/functional/ -x + -m 'not offline' -m 'not online' + -m 'not scenario' -c /dev/null + -p no:warnings -n 0 -v -o cache_dir=${GITHUB_WORKSPACE}/.pytest-cache diff --git a/.github/workflows/test_client_ubuntu_nightlies.yml b/.github/workflows/test_client_ubuntu_nightlies.yml index 2c022814..acf4aa5d 100644 --- a/.github/workflows/test_client_ubuntu_nightlies.yml +++ b/.github/workflows/test_client_ubuntu_nightlies.yml @@ -38,4 +38,4 @@ jobs: env: SIMVUE_URL: ${{ secrets.SIMVUE_NIGHTLY_URL }} SIMVUE_TOKEN: ${{ secrets.SIMVUE_NIGHTLY_TOKEN }} - run: python -m pytest tests/ -m 'not scenario' + run: python -m pytest tests/ -m 'not scenario' -c /dev/null -o cache_dir=${GITHUB_WORKSPACE}/.pytest-cache diff --git a/.github/workflows/test_multiple_python.yml b/.github/workflows/test_multiple_python.yml index 0a5aa8d9..65538f51 100644 --- a/.github/workflows/test_multiple_python.yml +++ b/.github/workflows/test_multiple_python.yml @@ -40,4 +40,4 @@ jobs: env: SIMVUE_URL: ${{ secrets.SIMVUE_NIGHTLY_URL }} SIMVUE_TOKEN: ${{ secrets.SIMVUE_NIGHTLY_TOKEN }} - run: python -m pytest tests/ -m 'not scenario' + run: python -m pytest tests/ -m 'not scenario' -c /dev/null -o cache_dir=${GITHUB_WORKSPACE}/.pytest-cache diff --git a/simvue/api/request.py b/simvue/api/request.py index 7f5496b1..c8a76a31 100644 --- a/simvue/api/request.py +++ b/simvue/api/request.py @@ -309,17 +309,24 @@ def get_paginated( # else if undefined or greater than the page limit use the limit _request_count: int = min(count or MAX_ENTRIES_PER_PAGE, MAX_ENTRIES_PER_PAGE) - while ( - _response := get( - url=url, - headers=headers, - params=(params or {}) | {"count": _request_count, "start": _offset}, - timeout=timeout, - json=json, + try: + while ( + _response := get( + url=url, + headers=headers, + params=(params or {}) | {"count": _request_count, "start": _offset}, + timeout=timeout, + json=json, + ) + ).json(): + yield _response + _offset += MAX_ENTRIES_PER_PAGE + + if (count and _offset > count) or ( + _response.json().get("count", 0) < _offset + ): + break + except json_module.JSONDecodeError: + raise RuntimeError( + f"[{_response.status_code}] Failed to retrieve content from server: {_response.text}" ) - ).json(): - yield _response - _offset += MAX_ENTRIES_PER_PAGE - - if (count and _offset > count) or (_response.json().get("count", 0) < _offset): - break diff --git a/tests/functional/test_run_class.py b/tests/functional/test_run_class.py index bbc0cb0d..67864dff 100644 --- a/tests/functional/test_run_class.py +++ b/tests/functional/test_run_class.py @@ -1,4 +1,5 @@ import json +import logging import os import pytest import pytest_mock @@ -598,6 +599,7 @@ def test_runs_multiple_series(request: pytest.FixtureRequest) -> None: def test_suppressed_errors( setup_logging: "CountingLogHandler", post_init: bool, request: pytest.FixtureRequest ) -> None: + logging.getLogger("simvue").setLevel(logging.DEBUG) setup_logging.captures = ["Skipping call to"] with sv_run.Run(mode="offline") as run: