File: conftest.py

package info (click to toggle)
python-vispy 0.16.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 9,112 kB
  • sloc: python: 61,648; javascript: 6,800; ansic: 2,104; makefile: 141; sh: 6
file content (25 lines) | stat: -rw-r--r-- 641 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import pytest
from vispy.gloo.gl import use_gl


@pytest.fixture(params=['points', 'instanced'])
def rendering_method(request):
    """Setup rendering method for test function, skip if backend unavailable.

    Tests that accept this fixture will run twice: once with 'points' method
    (gl2) and once with 'instanced' method (gl+).
    """
    method = request.param

    if method == 'instanced':
        try:
            use_gl('gl+')
        except Exception:
            pytest.skip("gl+ backend not available for instanced rendering")
    else:
        use_gl('gl2')

    yield method

    # Reset to gl2 after test
    use_gl('gl2')