From 4601db6480b65e6ff00351a42fa9278a8b30fab4 Mon Sep 17 00:00:00 2001 From: Andrew Clayton Date: Tue, 15 Oct 2024 22:29:51 +0100 Subject: ci: Install pytest via apt(8) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With Ubuntu 24.04 installing it via pip gave this error error: externally-managed-environment × This environment is externally managed ╰─> To install Python packages system-wide, try apt install python3-xyz, where xyz is the package you are trying to install. If you wish to install a non-Debian-packaged Python package, create a virtual environment using python3 -m venv path/to/venv. Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make sure you have python3-full installed. If you wish to install a non-Debian packaged Python application, it may be easiest to use pipx install xyz, which will manage a virtual environment for you. Make sure you have pipx installed. See /usr/share/doc/python3.12/README.venv for more information. Installing it via the package manager is the better option anyway... Under Ubuntu 22.04 it only installs a /usr/bin/pytest-3 binary, rather than installing a /usr/bin/pytest binary and symlink for pytest-3, so use pytest-3 as the command. Signed-off-by: Andrew Clayton --- .github/workflows/ci.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a7d0e715..672b82e0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -360,18 +360,15 @@ jobs: - name: Install pytest run: | - if [ "${{ matrix.build }}" == "wasm-wasi-component" ]; then - pip install pytest - else - sudo -H pip install pytest - fi + sudo apt install -y python3-pytest + if: steps.metadata.outputs.module != 'wasm' - name: Run ${{ steps.metadata.outputs.module }} tests run: | if [ "${{ matrix.build }}" == "wasm-wasi-component" ]; then - pytest --print-log ${{ steps.metadata.outputs.testpath }} + pytest-3 --print-log ${{ steps.metadata.outputs.testpath }} else - sudo -E pytest --print-log ${{ steps.metadata.outputs.testpath }} + sudo -E pytest-3 --print-log ${{ steps.metadata.outputs.testpath }} fi if: steps.metadata.outputs.module != 'wasm' -- cgit