From 20b868c083aa4e78a9905dbd56edead26acd2f37 Mon Sep 17 00:00:00 2001 From: appleb_m Date: Mon, 27 Apr 2026 14:21:56 +0200 Subject: [PATCH] gitea workflows: fix pytest dependency bug and add bec_lib to dependencies --- .gitea/workflows/action.yaml | 70 ++++++++++++++++++++++-------------- pyproject.toml | 2 ++ 2 files changed, 45 insertions(+), 27 deletions(-) diff --git a/.gitea/workflows/action.yaml b/.gitea/workflows/action.yaml index b89f2ef0..b33f4169 100644 --- a/.gitea/workflows/action.yaml +++ b/.gitea/workflows/action.yaml @@ -21,38 +21,54 @@ env: PYTHONPATH: src jobs: - test: - runs-on: ubuntu-latest - steps: - - name: Checkout Repository - uses: actions/checkout@v4 +test: + runs-on: ubuntu-latest - - name: Cache pip - uses: actions/cache@v4 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-test-${{ hashFiles('**/pyproject.toml') }} + steps: + - name: Checkout Repository + uses: actions/checkout@v4 - - name: Set Up Python - uses: actions/setup-python@v4 - with: - python-version: '3.12' + - name: Set Up Python + uses: actions/setup-python@v4 + with: + python-version: '3.12' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - - pip install pytest pytest-cov pytest-mock pytest-qt - - pip install \ - --index-url https://${{ secrets.GITEA_USER }}:${{ secrets.GITEA_TOKEN }}@gitea.psi.ch/api/packages/mx/pypi/simple/ \ - --extra-index-url https://pypi.org/simple \ - -e . + - name: Cache pip + uses: actions/cache@v4 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-test-${{ hashFiles('**/pyproject.toml') }} + restore-keys: | + ${{ runner.os }}-pip-test- - - name: Run tests with pytest - run: | - pytest --cov=aare --cov-report=xml tests/unit + - name: Create virtual environment + run: | + python -m venv venv + - name: Install dependencies + env: + PIP_INDEX_URL: https://${{ secrets.GITEA_USER }}:${{ secrets.GITEA_TOKEN }}@gitea.psi.ch/api/packages/mx/pypi/simple/ + PIP_EXTRA_INDEX_URL: https://pypi.org/simple + run: | + source venv/bin/activate + + python -m pip install --upgrade pip + + pip install pytest pytest-cov pytest-mock pytest-qt + + pip install -e . + + - name: Run tests with pytest + env: + PYTEST_DISABLE_PLUGIN_AUTOLOAD: "1" + run: | + source venv/bin/activate + + pytest \ + -p pytest_cov \ + --cov=aare \ + --cov-report=xml \ + tests/unit build: runs-on: ubuntu-latest needs: test diff --git a/pyproject.toml b/pyproject.toml index 2610b723..fe8ae10a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,6 +23,8 @@ dependencies = [ "websocket-client==1.8.0", "sseclient-py==1.8.0", "psi-pshell==2.1.0", + "bec_lib==3.117.3", + "bec-ipython-client==3.117.3", ] [lint]