Skip to content

Fix Pytest permission denied in CI #810

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 11, 2025
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/test_client_macos_nightlies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
32 changes: 26 additions & 6 deletions .github/workflows/test_client_ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/test_client_ubuntu_nightlies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/test_multiple_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
33 changes: 20 additions & 13 deletions simvue/api/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions tests/functional/test_run_class.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
import logging
import os
import pytest
import pytest_mock
Expand Down Expand Up @@ -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:
Expand Down
Loading