-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
"""This runs at the init of the pytest doctest session | ||
Launch or connect to a persistent local DPF service to be shared in | ||
pytest as a session fixture | ||
""" | ||
import re | ||
import os | ||
|
||
import pyvista as pv | ||
import matplotlib as mpl | ||
|
||
# enable off_screen plotting to avoid test interruption | ||
pv.OFF_SCREEN = True | ||
mpl.use("Agg") | ||
|
||
|
||
def get_lighting(): | ||
"""Get lighting configuration. | ||
Disable lighting when using OSMesa on Windows. See: | ||
https://github.com/pyvista/pyvista/issues/3185 | ||
""" | ||
pl = pv.Plotter(notebook=False, off_screen=True) | ||
pl.add_mesh(pv.Sphere()) | ||
pl.show(auto_close=False) | ||
gpu_info = pl.ren_win.ReportCapabilities(); | ||
pl.close() | ||
|
||
regex = re.compile("OpenGL version string:(.+)\n") | ||
version = regex.findall(gpu_info)[0] | ||
return not(os.name == 'nt' and 'Mesa' in version) | ||
|
||
|
||
pv.global_theme.lighting = get_lighting() |