diff --git a/tests/display/conftest.py b/tests/display/conftest.py index 821b06af80..09684fab84 100644 --- a/tests/display/conftest.py +++ b/tests/display/conftest.py @@ -1,23 +1,26 @@ import pytest -@pytest.fixture -def graphics_pipe(scope='session'): + +@pytest.fixture(scope='session') +def graphics_pipe(): from panda3d.core import GraphicsPipeSelection pipe = GraphicsPipeSelection.get_global_ptr().make_default_pipe() - if not pipe.is_valid(): - pytest.xfail("GraphicsPipe is invalid") + if pipe is None or not pipe.is_valid(): + pytest.skip("GraphicsPipe is invalid") yield pipe -@pytest.fixture -def graphics_engine(scope='session'): + +@pytest.fixture(scope='session') +def graphics_engine(): from panda3d.core import GraphicsEngine engine = GraphicsEngine.get_global_ptr() yield engine + @pytest.fixture def window(graphics_pipe, graphics_engine): from panda3d.core import GraphicsPipe, FrameBufferProperties, WindowProperties diff --git a/tests/display/test_window.py b/tests/display/test_window.py index d193fe92dd..1c44ea76e3 100644 --- a/tests/display/test_window.py +++ b/tests/display/test_window.py @@ -5,11 +5,12 @@ def test_window_basic(window): current_props = window.get_properties() default_props = WindowProperties.get_default() - # Opening the window changes these from the defaults + # Opening the window changes these from the defaults. Note that we have + # no guarantee that it opens in the foreground or with the requested size. default_props.set_size(current_props.get_size()) default_props.set_origin(current_props.get_origin()) default_props.set_minimized(False) - default_props.set_foreground(True) + default_props.foreground = current_props.foreground # The rest should be the same assert current_props == default_props