Skip to content

Commit cbce8f9

Browse files
authored
Add explicit testing of all supported Python versions (#403)
* Add testing of all supported Pythons * Run examples on Linux and all supported python versions * Use pyvista/setup-headless-display * Make the job Run Examples Lunix-compliant * Remove constraint of vtk<9.1.0 and Python<3.10 * Add core.settings.bypass_pv_opengl_osmesa_crash to fix issue with vtk>=9.1.0 on Windows GitHub runners using OpenGL from OSMesa * Doctest skip plot calls for now * Revert "Doctest skip plot calls for now" This reverts commit a57bc81. * Instead of skipping all plot doctests, add fix to doctest conftest * Skip doctest step for failing configs for now * Fix conditional * Fix conditional * Revert changes to matrix for gatebin tests * Revert changes to matrix for retro tests * Switching retro to 3.7, skipping test_shutting_down_when_deleted_legacy on Windows in addition to Linux. * Switching back to 3.8 testing by default. More will be tested in the PR about reorganizing tests. * Revert "Switching back to 3.8 testing by default." This reverts commit 651624c. * Skip test_python_plugins.py if on Linux with Python 3.7. * Skip test_create_on_other_server_and_connect_workflow for 3.10 on Windows * Skip test_create_on_other_server_and_connect_workflow for 3.10 on Ubuntu and not Windows * Skip test_python_plugins.py for 3.7 * Skip test_shutting_down_when_deleted_legacy.py for 3.7 on Linux
1 parent 084386c commit cbce8f9

File tree

11 files changed

+86
-70
lines changed

11 files changed

+86
-70
lines changed

.github/workflows/ci.yml

Lines changed: 29 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
strategy:
2929
fail-fast: false
3030
matrix:
31-
python-version: ["3.8"]
31+
python-version: ["3.7", "3.8", "3.9", "3.10"]
3232
os: ["windows-latest", "ubuntu-18.04"]
3333

3434
steps:
@@ -53,6 +53,7 @@ jobs:
5353

5454
- name: "Test Docstrings"
5555
uses: pyansys/pydpf-actions/[email protected]
56+
if: matrix.python-version != '3.10' && matrix.python-version != '3.7' && matrix.os != 'Linux'
5657
with:
5758
MODULE: ${{env.MODULE}}
5859
PACKAGE_NAME: ${{env.PACKAGE_NAME}}
@@ -96,7 +97,7 @@ jobs:
9697
pytest $DEBUG --cov=ansys.dpf.${{env.MODULE}} --cov-report=xml --cov-report=html --log-level=ERROR --junitxml=junit/test-results.xml --reruns 2 .
9798
9899
- name: "Kill all servers"
99-
uses: pyansys/pydpf-actions/[email protected]
100+
uses: pyansys/pydpf-actions/[email protected].dev1
100101

101102
- name: "Test API test_launcher"
102103
shell: bash
@@ -105,7 +106,7 @@ jobs:
105106
pytest $DEBUG --cov=ansys.dpf.core --cov-report=xml --cov-report=html --cov-append --log-level=ERROR --junitxml=../tests/junit/test-results2.xml --reruns 2 .
106107
107108
- name: "Kill all servers"
108-
uses: pyansys/pydpf-actions/[email protected]
109+
uses: pyansys/pydpf-actions/[email protected].dev1
109110

110111
- name: "Test API test_server"
111112
shell: bash
@@ -114,7 +115,7 @@ jobs:
114115
pytest $DEBUG --cov=ansys.dpf.core --cov-report=xml --cov-report=html --cov-append --log-level=ERROR --junitxml=../tests/junit/test-results4.xml --reruns 2 .
115116
116117
- name: "Kill all servers"
117-
uses: pyansys/pydpf-actions/[email protected]
118+
uses: pyansys/pydpf-actions/[email protected].dev1
118119

119120
- name: "Test API test_local_server"
120121
shell: bash
@@ -123,7 +124,7 @@ jobs:
123124
pytest $DEBUG --cov=ansys.dpf.core --cov-report=xml --cov-report=html --cov-append --log-level=ERROR --junitxml=../tests/junit/test-results5.xml --reruns 2 .
124125
125126
- name: "Kill all servers"
126-
uses: pyansys/pydpf-actions/[email protected]
127+
uses: pyansys/pydpf-actions/[email protected].dev1
127128

128129
- name: "Test API test_multi_server"
129130
shell: bash
@@ -132,7 +133,7 @@ jobs:
132133
pytest $DEBUG --cov=ansys.dpf.core --cov-report=xml --cov-report=html --cov-append --log-level=ERROR --junitxml=../tests/junit/test-results6.xml --reruns 2 .
133134
134135
- name: "Kill all servers"
135-
uses: pyansys/pydpf-actions/[email protected]
136+
uses: pyansys/pydpf-actions/[email protected].dev1
136137

137138
- name: "Test API test_remote_workflow"
138139
shell: bash
@@ -141,7 +142,7 @@ jobs:
141142
pytest $DEBUG --cov=ansys.dpf.core --cov-report=xml --cov-report=html --cov-append --log-level=ERROR --junitxml=../tests/junit/test-results7.xml --reruns 2 .
142143
143144
- name: "Kill all servers"
144-
uses: pyansys/pydpf-actions/[email protected]
145+
uses: pyansys/pydpf-actions/[email protected].dev1
145146

146147
- name: "Test API test_remote_operator"
147148
shell: bash
@@ -150,21 +151,21 @@ jobs:
150151
pytest $DEBUG --cov=ansys.dpf.core --cov-report=xml --cov-report=html --cov-append --log-level=ERROR --junitxml=../tests/junit/test-results8.xml --reruns 2 .
151152
152153
- name: "Kill all servers"
153-
uses: pyansys/pydpf-actions/[email protected]
154+
uses: pyansys/pydpf-actions/[email protected].dev1
154155

155-
- name: "Test API 3"
156+
- name: "Test API test_workflow"
156157
shell: bash
157158
working-directory: test_workflow
158159
run: |
159160
pytest $DEBUG --cov=ansys.dpf.core --cov-report=xml --cov-report=html --cov-append --log-level=ERROR --junitxml=../tests/junit/test-results3.xml --reruns 3 .
160161
161162
- name: "Kill all servers"
162-
uses: pyansys/pydpf-actions/[email protected]
163+
uses: pyansys/pydpf-actions/[email protected].dev1
163164

164165
- name: "Upload Test Results"
165166
uses: actions/upload-artifact@v2
166167
with:
167-
name: ${{ env.PACKAGE_NAME }}_pytest
168+
name: ${{ env.PACKAGE_NAME }}_${{ matrix.python-version }}_${{ matrix.os }}_pytest_${{ env.ANSYS_VERSION }}
168169
path: tests/junit/test-results.xml
169170

170171
- name: "Upload coverage to Codecov"
@@ -206,39 +207,28 @@ jobs:
206207
install_extras: plotting
207208
wheelhouse: false
208209

209-
- name: Install OpenGL
210-
run: |
211-
Set-StrictMode -Version Latest
212-
$ErrorActionPreference = "Stop"
213-
$PSDefaultParameterValues['*:ErrorAction']='Stop'
214-
git clone --depth 1 https://github.com/pyvista/gl-ci-helpers.git
215-
powershell gl-ci-helpers/appveyor/install_opengl.ps1
210+
- name: "Setup headless display"
211+
uses: pyvista/setup-headless-display-action@v1
216212

217-
- name: Install test offscreen rendering
218-
run: |
219-
.ci/setup_headless_display.sh
220-
pip install -r .ci/requirements_test_xvfb.txt
221-
python .ci/display_test.py
222-
223-
- name: Setup Graphviz
213+
- name: "Setup Graphviz"
224214
uses: ts-graphviz/setup-graphviz@v1
225215

226216
- name: Install documentation packages for Python
227217
run: |
228218
pip install -r requirements/requirements_docs.txt
229219
230220
- name: "Kill all servers"
231-
uses: pyansys/pydpf-actions/[email protected]
221+
uses: pyansys/pydpf-actions/[email protected].dev1
232222

233-
- name: Build Documentation
223+
- name: "Build Documentation"
234224
shell: cmd
235225
run: |
236226
cd .ci
237227
build_doc.bat > ..\docs\log.txt && type ..\docs\log.txt 2>&1
238228
timeout-minutes: 20
239229

240230
- name: "Kill all servers"
241-
uses: pyansys/pydpf-actions/[email protected]
231+
uses: pyansys/pydpf-actions/[email protected].dev1
242232

243233
- name: Publish Documentation artifact
244234
uses: actions/upload-artifact@v3
@@ -306,68 +296,55 @@ jobs:
306296
install_extras: plotting
307297
wheelhouse: false
308298

309-
- name: Install OpenGL
310-
run: |
311-
Set-StrictMode -Version Latest
312-
$ErrorActionPreference = "Stop"
313-
$PSDefaultParameterValues['*:ErrorAction']='Stop'
314-
git clone --depth 1 https://github.com/pyvista/gl-ci-helpers.git
315-
powershell gl-ci-helpers/appveyor/install_opengl.ps1
316-
317-
- name: Install test offscreen rendering
318-
run: |
319-
.ci/setup_headless_display.sh
320-
pip install -r .ci/requirements_test_xvfb.txt
321-
python .ci/display_test.py
299+
- name: "Setup headless display"
300+
uses: pyvista/setup-headless-display-action@v1
322301

323302
- name: "Check examples with gatebin"
324-
shell: cmd
303+
shell: bash
325304
run: |
326305
echo on
327306
cd .ci
328-
dir .
307+
ls .
329308
python run_examples.py
330309
331310
- name: "Kill all servers"
332-
uses: pyansys/pydpf-actions/[email protected]
311+
uses: pyansys/pydpf-actions/[email protected].dev1
333312

334313
- name: "Uninstall gatebin"
335314
shell: bash
336315
run: |
337316
pip uninstall -y ansys-dpf-gatebin
338317
339318
- name: "Check sanity without gatebin INPROCESS"
340-
shell: cmd
319+
shell: bash
341320
run: |
342321
cd .ci
343322
python run_non_regression_examples.py
344323
env:
345324
DPF_SERVER_TYPE: INPROCESS
346325

347326
- name: "Kill all servers"
348-
uses: pyansys/pydpf-actions/[email protected]
327+
uses: pyansys/pydpf-actions/[email protected].dev1
349328

350329

351330
- name: "Check sanity without gatebin GRPC"
352-
shell: cmd
331+
shell: bash
353332
run: |
354333
cd .ci
355334
python run_non_regression_examples.py
356335
env:
357336
DPF_SERVER_TYPE: GRPC
358337

359338
- name: "Kill all servers"
360-
uses: pyansys/pydpf-actions/[email protected]
339+
uses: pyansys/pydpf-actions/[email protected].dev1
361340

362341
- name: "Check sanity without gatebin LEGACYGRPC"
363-
shell: cmd
342+
shell: bash
364343
run: |
365344
cd .ci
366345
python run_non_regression_examples.py
367346
env:
368347
DPF_SERVER_TYPE: LEGACYGRPC
369348

370349
- name: "Kill all servers"
371-
uses: pyansys/pydpf-actions/[email protected]
372-
373-
350+
uses: pyansys/pydpf-actions/[email protected]

.github/workflows/retro.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
strategy:
2121
fail-fast: false
2222
matrix:
23-
python-version: ["3.8"]
23+
python-version: ["3.7"]
2424
os: ["windows-latest", "ubuntu-18.04"]
2525
env:
2626
ANSYS_VERSION: 221
@@ -84,10 +84,10 @@ jobs:
8484
shell: bash
8585
working-directory: tests
8686
run: |
87-
pytest $DEBUG --cov=ansys.dpf.${{env.MODULE}} --cov-report=xml --cov-report=html --log-level=ERROR --junitxml=junit/test-results.xml --reruns 2 .
87+
pytest $DEBUG --cov=ansys.dpf.${{env.MODULE}} --cov-report=xml --cov-report=html --cov-append --log-level=ERROR --junitxml=junit/test-results.xml --reruns 2 .
8888
8989
- name: "Kill all servers"
90-
uses: pyansys/pydpf-actions/[email protected]
90+
uses: pyansys/pydpf-actions/[email protected].dev1
9191

9292
- name: "Test API test_launcher"
9393
shell: bash
@@ -96,7 +96,7 @@ jobs:
9696
pytest $DEBUG --cov=ansys.dpf.core --cov-report=xml --cov-report=html --cov-append --log-level=ERROR --junitxml=../tests/junit/test-results2.xml --reruns 2 .
9797
9898
- name: "Kill all servers"
99-
uses: pyansys/pydpf-actions/[email protected]
99+
uses: pyansys/pydpf-actions/[email protected].dev1
100100

101101
- name: "Test API test_server"
102102
shell: bash
@@ -105,7 +105,7 @@ jobs:
105105
pytest $DEBUG --cov=ansys.dpf.core --cov-report=xml --cov-report=html --cov-append --log-level=ERROR --junitxml=../tests/junit/test-results4.xml --reruns 2 .
106106
107107
- name: "Kill all servers"
108-
uses: pyansys/pydpf-actions/[email protected]
108+
uses: pyansys/pydpf-actions/[email protected].dev1
109109

110110
- name: "Test API test_local_server"
111111
shell: bash
@@ -114,7 +114,7 @@ jobs:
114114
pytest $DEBUG --cov=ansys.dpf.core --cov-report=xml --cov-report=html --cov-append --log-level=ERROR --junitxml=../tests/junit/test-results5.xml --reruns 2 .
115115
116116
- name: "Kill all servers"
117-
uses: pyansys/pydpf-actions/[email protected]
117+
uses: pyansys/pydpf-actions/[email protected].dev1
118118

119119
- name: "Test API test_multi_server"
120120
shell: bash
@@ -123,7 +123,7 @@ jobs:
123123
pytest $DEBUG --cov=ansys.dpf.core --cov-report=xml --cov-report=html --cov-append --log-level=ERROR --junitxml=../tests/junit/test-results6.xml --reruns 2 .
124124
125125
- name: "Kill all servers"
126-
uses: pyansys/pydpf-actions/[email protected]
126+
uses: pyansys/pydpf-actions/[email protected].dev1
127127

128128
- name: "Test API test_remote_workflow"
129129
shell: bash
@@ -132,7 +132,7 @@ jobs:
132132
pytest $DEBUG --cov=ansys.dpf.core --cov-report=xml --cov-report=html --cov-append --log-level=ERROR --junitxml=../tests/junit/test-results7.xml --reruns 2 .
133133
134134
- name: "Kill all servers"
135-
uses: pyansys/pydpf-actions/[email protected]
135+
uses: pyansys/pydpf-actions/[email protected].dev1
136136

137137
- name: "Test API test_remote_operator"
138138
shell: bash
@@ -141,21 +141,21 @@ jobs:
141141
pytest $DEBUG --cov=ansys.dpf.core --cov-report=xml --cov-report=html --cov-append --log-level=ERROR --junitxml=../tests/junit/test-results8.xml --reruns 2 .
142142
143143
- name: "Kill all servers"
144-
uses: pyansys/pydpf-actions/[email protected]
144+
uses: pyansys/pydpf-actions/[email protected].dev1
145145

146-
- name: "Test API 3"
146+
- name: "Test API test_workflow"
147147
shell: bash
148148
working-directory: test_workflow
149149
run: |
150150
pytest $DEBUG --cov=ansys.dpf.core --cov-report=xml --cov-report=html --cov-append --log-level=ERROR --junitxml=../tests/junit/test-results3.xml --reruns 3 .
151151
152152
- name: "Kill all servers"
153-
uses: pyansys/pydpf-actions/[email protected]
153+
uses: pyansys/pydpf-actions/[email protected].dev1
154154

155155
- name: "Upload Test Results"
156156
uses: actions/upload-artifact@v2
157157
with:
158-
name: ${{ env.PACKAGE_NAME }}_pytest
158+
name: ${{ env.PACKAGE_NAME }}_${{ matrix.python-version }}_${{ matrix.os }}_pytest_${{ env.ANSYS_VERSION }}
159159
path: tests/junit/test-results.xml
160160

161161
- name: "Upload coverage to Codecov"

ansys/dpf/core/settings.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
========
55
Customize the behavior of the module.
66
"""
7+
import os
8+
import re
79

810
from ansys.dpf.core.misc import module_exists
911
from ansys.dpf.core import misc
@@ -38,6 +40,30 @@ def set_default_pyvista_config():
3840
pv.rcParams["title"] = "DPF"
3941

4042

43+
def bypass_pv_opengl_osmesa_crash():
44+
if module_exists("pyvista"):
45+
import pyvista as pv
46+
47+
def get_lighting():
48+
"""Get lighting configuration.
49+
50+
Disable lighting when using OSMesa on Windows. See:
51+
https://github.com/pyvista/pyvista/issues/3185
52+
53+
"""
54+
pl = pv.Plotter(notebook=False, off_screen=True)
55+
pl.add_mesh(pv.Sphere())
56+
pl.show(auto_close=False)
57+
gpu_info = pl.ren_win.ReportCapabilities()
58+
pl.close()
59+
60+
regex = re.compile("OpenGL version string:(.+)\n")
61+
version = regex.findall(gpu_info)[0]
62+
return not(os.name == 'nt' and 'Mesa' in version)
63+
64+
pv.global_theme.lighting = get_lighting()
65+
66+
4167
def disable_interpreter_properties_evaluation() -> bool:
4268
"""If ``jedi`` module is installed (autocompletion module for most of IDEs), disables the
4369
property evaluation when tab key is pressed.

conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""This runs at the init of the pytest session
1+
"""This runs at the init of the doctest pytest session
22
33
Launch or connect to a persistent local DPF service to be shared in
44
pytest as a session fixture
@@ -16,3 +16,4 @@
1616

1717
# enable off_screen plotting to avoid test interruption
1818
core.settings.disable_off_screen_rendering()
19+
core.settings.bypass_pv_opengl_osmesa_crash()

requirements/requirements_docs.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
pypandoc==1.8.1
2-
vtk<9.1.0
32
pyvista==0.36.1
43
ansys_sphinx_theme==0.5.1
54
nbsphinx==0.8.9

requirements/requirements_test.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
pytest==7.1.2
22
pytest-cov==3.0.0
33
pytest-rerunfailures==10.2
4-
vtk==9.0.3
54
pyvista==0.36.1
65
ansys-platform-instancemanagement==1.0.2
76
coverage==6.4.3

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"Programming Language :: Python :: 3.7",
5353
"Programming Language :: Python :: 3.8",
5454
"Programming Language :: Python :: 3.9",
55+
"Programming Language :: Python :: 3.10",
5556
],
5657
package_data={
5758
"ansys.dpf.core.examples": [
@@ -81,7 +82,7 @@
8182
author='ANSYS',
8283
author_email='[email protected]',
8384
maintainer_email="[email protected]",
84-
python_requires=">=3.7.*",
85+
python_requires=">=3.7.*,<4.0",
8586
install_requires=install_requires,
8687
extras_require={
8788
"plotting": ["pyvista>=0.32.0", "matplotlib>=3.2"],

0 commit comments

Comments
 (0)