summaryrefslogtreecommitdiff
path: root/.github
diff options
context:
space:
mode:
authorMatthieu Darbois <mayeut@users.noreply.github.com>2023-03-27 23:37:16 +0200
committerGitHub <noreply@github.com>2023-03-27 23:37:16 +0200
commit64b4318bce1a2ba8dcc0b8f7cbaefeb029c12419 (patch)
tree0dff418c1ae6f1c0abd66c83e2196eb2ae551ad6 /.github
parentd07e7f84579b05934bc525614177ec0e1a3b4dd4 (diff)
downloadpsutil-64b4318bce1a2ba8dcc0b8f7cbaefeb029c12419.tar.gz
Win: fix running tests in a virtual environment (#2216)
On windows, starting with python 3.7, virtual environments use a venvlauncher startup process This does not play well when counting spawned processes or when relying on the pid of the spawned process to do some checks e.g. connection check per pid This commit detects this situation and uses the base python executable to spawn processes when required. Signed-off-by: mayeut <mayeut@users.noreply.github.com>
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/build.yml60
1 files changed, 12 insertions, 48 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index e2d015c1..eb6996da 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -22,14 +22,21 @@ name: build
jobs:
# Linux + macOS + Windows Python 3
py3:
- name: py3-${{ matrix.os }}
+ name: py3-${{ matrix.os }}-${{ startsWith(matrix.os, 'windows') && matrix.archs || 'all' }}
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
- os: [ubuntu-latest, macos-12, windows-2019]
- # python: ["3.6", "3.11"]
+ include:
+ - os: ubuntu-latest
+ archs: "x86_64 i686"
+ - os: macos-12
+ archs: "x86_64 arm64"
+ - os: windows-2019
+ archs: "AMD64"
+ - os: windows-2019
+ archs: "x86"
steps:
- name: Cancel previous runs
@@ -44,6 +51,8 @@ jobs:
- name: Create wheels + run tests
uses: pypa/cibuildwheel@v2.11.2
+ env:
+ CIBW_ARCHS: "${{ matrix.archs }}"
- name: Upload wheels
uses: actions/upload-artifact@v3
@@ -58,51 +67,6 @@ jobs:
python setup.py sdist
mv dist/psutil*.tar.gz wheelhouse/
- # Windows cp37+ tests
- # psutil tests do not like running from a virtualenv with python>=3.7 so
- # not using cibuildwheel for those. run them "manually" with this job.
- py3-windows-tests:
- name: py3-windows-test-${{ matrix.python }}-${{ matrix.architecture }}
- needs: py3
- runs-on: windows-2019
- timeout-minutes: 20
- strategy:
- fail-fast: false
- matrix:
- python: ["3.7", "3.8", "3.9", "3.10", "3.11"]
- architecture: ["x86", "x64"]
-
- steps:
- - name: Cancel previous runs
- uses: styfle/cancel-workflow-action@0.9.1
- with:
- access_token: ${{ github.token }}
-
- - uses: actions/checkout@v3
-
- - uses: actions/setup-python@v4
- with:
- python-version: "${{ matrix.python }}"
- architecture: "${{ matrix.architecture }}"
-
- - name: Download wheels
- uses: actions/download-artifact@v3
- with:
- name: wheels
- path: wheelhouse
-
- - name: Run tests
- run: |
- mkdir .tests
- cd .tests
- pip install $(find ../wheelhouse -name '*-cp36-abi3-${{ matrix.architecture == 'x86' && 'win32' || 'win_amd64'}}.whl')[test]
- export PYTHONWARNINGS=always
- export PYTHONUNBUFFERED=1
- export PSUTIL_DEBUG=1
- python ../psutil/tests/runner.py
- python ../psutil/tests/test_memleaks.py
- shell: bash
-
# Linux + macOS + Python 2
py2:
name: py2-${{ matrix.os }}