Skip to content

Commit d359c85

Browse files
committed
Isolate tests for without Qt
1 parent 47755fd commit d359c85

File tree

1 file changed

+57
-25
lines changed

1 file changed

+57
-25
lines changed

.github/workflows/test.yml

Lines changed: 57 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,26 +23,19 @@ jobs:
2323
matrix:
2424
os: [ubuntu-latest, macOS-latest, windows-latest]
2525
py: ['3.7', '3.8', '3.9', '3.10']
26-
qt-lib: ['pyqt', 'pyside', 'none']
26+
qt-lib: ['pyqt', 'pyside']
2727
include:
2828
- {py: '3.7', qt-lib: 'pyqt', qt: 'PyQt5~=5.15.0'}
2929
- {py: '3.7', qt-lib: 'pyside', qt: 'PySide2'}
30-
- {py: '3.7', qt-lib: 'none', qt: 'none'}
3130
- {py: '3.8', qt-lib: 'pyqt', qt: 'PyQt5'}
3231
- {py: '3.8', qt-lib: 'pyside', qt: 'PySide6-Essentials'}
33-
- {py: '3.8', qt-lib: 'none', qt: 'none'}
3432
- {py: '3.9', qt-lib: 'pyqt', qt: 'PyQt6'}
3533
- {py: '3.9', qt-lib: 'pyside', qt: 'PySide6-Essentials'}
36-
- {py: '3.9', qt-lib: 'none', qt: 'none'}
3734
- {py: '3.10', qt-lib: 'pyqt', qt: 'PyQt6'}
3835
- {py: '3.10', qt-lib: 'pyside', qt: 'PySide6-Essentials'}
39-
- {py: '3.10', qt-lib: 'none', qt: 'none'}
4036
- {py: '3.11', qt-lib: 'pyqt', qt: 'PyQt6', os: ubuntu-latest}
41-
- {py: '3.11', qt-lib: 'pyqt', qt: 'none', os: ubuntu-latest}
4237
- {py: '3.11', qt-lib: 'pyqt', qt: 'PyQt6', os: macOS-latest}
43-
- {py: '3.11', qt-lib: 'pyqt', qt: 'none', os: macOS-latest}
4438
- {py: '3.11', qt-lib: 'pyqt', qt: 'PyQt6', os: windows-latest}
45-
- {py: '3.11', qt-lib: 'pyqt', qt: 'none', os: windows-latest}
4639
runs-on: ${{ matrix.os }}
4740
name: ${{ matrix.os }} py-${{ matrix.py }} qt-${{ matrix.qt }}
4841

@@ -71,10 +64,9 @@ jobs:
7164

7265
- name: Install dependencies
7366
if: steps.cache-venv.outputs.cache-hit != 'true'
74-
run: poetry install --only dev,github-actions,test,main
67+
run: poetry install --only github-actions,test,main
7568

7669
- name: Install Qt dependencies
77-
if: matrix.qt != 'none'
7870
run: poetry run pip install -U ${{ matrix.qt }}
7971

8072
- name: Install Linux dependencies
@@ -95,40 +87,80 @@ jobs:
9587
libopengl0
9688
9789
- name: Run pytest
98-
if: matrix.qt != 'none'
9990
run: poetry run pytest --cov --cov-report=term-missing --cov-report=xml
10091

101-
- name: Run pytest without Qt lib
102-
if: matrix.qt == 'none'
103-
run: |
104-
poetry run pytest \
105-
--cov \
106-
--cov-report=term-missing \
107-
--cov-report=xml \
108-
--ignore=tests/test_widget_gallery.py \
109-
--ignore=tests/test_qdarktheme_with_qt.py \
110-
-p no:pytest-qt
111-
11292
- name: Upload coverage to Codecov
11393
uses: codecov/codecov-action@v3
11494
with:
11595
fail_ci_if_error: true
11696
token: ${{ secrets.CODECOV_TOKEN }}
11797

11898
- name: Capture img of WidgetGallery
119-
if: matrix.qt != 'none'
12099
run: |
121100
poetry run python ./tools/capture.py \
122101
-i ${{runner.os}}-py${{matrix.py}}-${{matrix.qt}} \
123102
-d ${{ env.TEST_IMG_OUTPUT_PATH}}
124103
125-
- name: Archive img of WidgetGallery
126-
if: matrix.qt != 'none'
104+
- name: Archive WidgetGallery img
127105
uses: actions/upload-artifact@v3
128106
with:
129107
name: widget-img
130108
path: ./${{ env.TEST_IMG_OUTPUT_PATH}}/*.png
131109

110+
111+
# Python version does not affect tests without Qt.
112+
# So we don't need to test multiple python versions.
113+
pytest-without-qt:
114+
strategy:
115+
fail-fast: false
116+
matrix:
117+
os: [ubuntu-latest, macOS-latest, windows-latest]
118+
runs-on: ${{ matrix.os }}
119+
name: ${{ matrix.os }}
120+
121+
steps:
122+
- uses: actions/checkout@v3
123+
- name: Setup Poetry
124+
run: |
125+
pipx install poetry
126+
poetry config virtualenvs.in-project true
127+
- uses: actions/setup-python@v4
128+
id: setup-python
129+
with:
130+
python-version: '3.11'
131+
132+
- name: Cache ./.venv (poetry dependencies)
133+
id: cache-venv
134+
uses: actions/cache@v3
135+
with:
136+
path: .venv
137+
key: "\
138+
venv-without-qt\
139+
${{ runner.os }}-\
140+
${{ steps.setup-python.outputs.python-version }}-\
141+
${{ hashFiles('**/poetry.lock') }}"
142+
143+
- name: Install dependencies
144+
if: steps.cache-venv.outputs.cache-hit != 'true'
145+
run: poetry install --only github-actions,test,main
146+
147+
- name: Run pytest without Qt lib
148+
run: |
149+
poetry run pytest \
150+
--cov \
151+
--cov-report=term-missing \
152+
--cov-report=xml \
153+
--ignore=tests/test_widget_gallery.py \
154+
--ignore=tests/test_qdarktheme_with_qt.py \
155+
-p no:pytest-qt
156+
157+
- name: Upload coverage to Codecov
158+
uses: codecov/codecov-action@v3
159+
with:
160+
fail_ci_if_error: true
161+
token: ${{ secrets.CODECOV_TOKEN }}
162+
163+
132164
pyinstaller:
133165
runs-on: ubuntu-latest
134166
steps:

0 commit comments

Comments
 (0)