Skip to content

Commit 1d0539f

Browse files
authored
use venv everywhere (gijzelaerr#505)
* use venv everywhere * fix windows
1 parent c2b1c46 commit 1d0539f

6 files changed

+86
-51
lines changed

.github/workflows/build-and-test-amd64.yml

+44-22
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,14 @@ jobs:
9090
path: wheelhouse/${{ runner.os }}/*.whl
9191

9292

93-
test-wheels-86_64:
94-
name: Testing wheels for AMD64
95-
needs: [linux-build, windows-build, osx-build]
93+
test-wheels-unix-86_64:
94+
name: Testing wheels for AMD64 unix
95+
needs: [linux-build, osx-build]
9696
continue-on-error: true
9797
runs-on: ${{ matrix.os }}
9898
strategy:
9999
matrix:
100-
os: [ubuntu-22.04, ubuntu-20.04, macos-14, macos-11, windows-2022, windows-2019]
100+
os: [ubuntu-22.04, ubuntu-20.04, macos-14, macos-11]
101101
python-version: ["3.9", "3.10", "3.11", "3.12"]
102102
steps:
103103
- name: Checkout
@@ -108,33 +108,55 @@ jobs:
108108
with:
109109
python-version: ${{ matrix.python-version }}
110110

111-
- name: Install pytest
112-
run: |
113-
python3 -m pip install --upgrade pip
114-
python3 -m pip install pytest
115-
116111
- name: Download artifacts
117112
uses: actions/download-artifact@v4
118113
with:
119114
name: wheels-${{ runner.os }}
120115
path: wheelhouse
121116

122117
- name: Install python-snap7
123-
run: python3 -m pip install $(ls wheelhouse/*.whl)
118+
run: |
119+
python3 -m venv venv
120+
venv/bin/pip install --upgrade pip
121+
venv/bin/pip install pytest
122+
venv/bin/pip install $(ls wheelhouse/*.whl)
124123
125-
- name: Run pytest
124+
- name: Run tests
126125
run: |
127-
which pytest
128-
pytest -m "server or util or client or mainloop"
126+
venv/bin/pytest -m "server or util or client or mainloop"
127+
sudo venv/bin/pytest -m partner
129128
130-
- name: Run tests required sudo
131-
if: ${{ runner.os == 'Linux'}}
132-
run: sudo /opt/hostedtoolcache/Python/${{ matrix.python-version }}*/x64/bin/pytest -m partner
133129
134-
- name: Run tests required sudo
135-
if: ${{ runner.os == 'macOS'}}
136-
run: sudo pytest -m partner
137130
138-
- name: Run tests required sudo
139-
if: ${{ runner.os == 'Windows'}}
140-
run: pytest -m partner
131+
test-wheels-windows-86_64:
132+
name: Testing wheels for AMD64 windows
133+
needs: [windows-build,]
134+
continue-on-error: true
135+
runs-on: ${{ matrix.os }}
136+
strategy:
137+
matrix:
138+
os: [windows-2022, windows-2019]
139+
python-version: ["3.9", "3.10", "3.11", "3.12"]
140+
steps:
141+
- name: Checkout
142+
uses: actions/checkout@v4
143+
144+
- name: Set up Python ${{ matrix.python-version }}
145+
uses: actions/setup-python@v5
146+
with:
147+
python-version: ${{ matrix.python-version }}
148+
149+
- name: Download artifacts
150+
uses: actions/download-artifact@v4
151+
with:
152+
name: wheels-${{ runner.os }}
153+
path: wheelhouse
154+
155+
- name: Install python-snap7
156+
run: |
157+
python3 -m pip install --upgrade pip pytest
158+
python3 -m pip install $(ls wheelhouse/*.whl)
159+
160+
- name: Run pytest
161+
run: |
162+
pytest -m "server or util or client or mainloop or partner"

.github/workflows/build-and-test-arm64.yml

+5-4
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,9 @@ jobs:
6363
-v $PWD/pyproject.toml:/pyproject.toml \
6464
-v $PWD/wheelhouse:/wheelhouse \
6565
"arm64v8/python:${{ matrix.python-version }}-bookworm" /bin/bash -s <<EOF
66-
python3 -m pip install --upgrade pip
67-
python3 -m pip install $(ls wheelhouse/*_aarch64.whl)
68-
python3 -m pip install pytest
69-
python3 -m pytest tests/test_client.py tests/test_mainloop.py tests/test_server.py tests/test_util.py
66+
python3 -m venv venv
67+
venv/bin/pip install --upgrade pip
68+
venv/bin/pip install pytest
69+
venv/bin/pip install $(ls wheelhouse/*.whl)
70+
venv/bin/pytest -m "server or util or client or mainloop or partner"
7071
EOF
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: OS X Test
2+
on:
3+
push:
4+
branches: [master]
5+
pull_request:
6+
branches: [master]
7+
jobs:
8+
osx_wheel:
9+
strategy:
10+
matrix:
11+
python-version: [ "3.9", "3.10", "3.11", "3.12" ]
12+
runs-on: [ "macos-14", "macos-11" ]
13+
runs-on: ${{ matrix.runs-on }}
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
- name: Install snap7
18+
run: brew install snap7 python@${{ matrix.python-version }}
19+
- name: Install python-snap7
20+
run: |
21+
python${{ matrix.python-version }} -m venv venv
22+
venv/bin/python3 -m pip install --upgrade pip setuptools
23+
venv/bin/python3 -m pip install -e .[test]
24+
- name: Run pytest
25+
run: |
26+
venv/bin/pytest -m "server or util or client or mainloop"
27+
sudo venv/bin/pytest -m partner

.github/workflows/osx.yml

-24
This file was deleted.

.github/workflows/windows.yml renamed to .github/workflows/windows-test.yml

+10-1
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,20 @@ on:
77
jobs:
88
windows_wheel:
99
continue-on-error: true
10-
runs-on: windows-2022
10+
strategy:
11+
matrix:
12+
runs-on: [ "windows-2022", "windows-2019" ]
13+
python-version: ["3.9", "3.10", "3.11", "3.12"]
14+
runs-on: ${{ matrix.runs-on }}
1115
steps:
1216
- name: Checkout
1317
uses: actions/checkout@v4
1418

19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
1524
- name: Prepare snap7 archive
1625
uses: ./.github/actions/prepare_snap7
1726

0 commit comments

Comments
 (0)