Commit bfc24ac1 authored by Thomas Dowrick's avatar Thomas Dowrick
Browse files

Don't run tests on linux when on Gitlab-CI

parent aa913ea3
Pipeline #1435 failed with stage
in 8 minutes and 2 seconds
import os
import sys
import pytest
from sksurgeryardavinci.widgets import Viewers
from sksurgeryvtk.models.vtk_surface_model_directory_loader \
import VTKSurfaceModelDirectoryLoader
# GUI tests causing error on Linux CI-machine.
if os.environ.get('GITLAB_CI')=='True' and sys.platform == "linux":
pytest.skip("skipping GUI tests on linux CI", allow_module_level=True)
@pytest.fixture()
def mono_viewer(qtbot):
mono_viewer = Viewers.MonoViewer('tests/data/test_video.avi')
qtbot.addWidget(mono_viewer)
vtk_model_path = 'inputs/Liver'
vtk_model_loader = VTKSurfaceModelDirectoryLoader(vtk_model_path)
mono_viewer.add_VTK_models(vtk_model_loader.models)
mono_viewer.start()
return mono_viewer
def test_opacity_slider_for_correct_opacity(qtbot):
mono_viewer = Viewers.MonoViewer('tests/data/test_video.avi')
qtbot.addWidget(mono_viewer)
vtk_model_path = 'inputs/Liver'
vtk_model_loader = VTKSurfaceModelDirectoryLoader(vtk_model_path)
mono_viewer.add_VTK_models(vtk_model_loader.models)
mono_viewer.start()
mono_viewer.UI.opacity_slider.setSliderPosition(50)
for vtk_model in mono_viewer.UI.vtk_models:
assert vtk_model.actor.GetProperty().GetOpacity() == 0.5
mono_viewer.UI.opacity_slider.setSliderPosition(0)
for vtk_model in mono_viewer.UI.vtk_models:
assert vtk_model.actor.GetProperty().GetOpacity() == 0
mono_viewer.UI.opacity_slider.setSliderPosition(100)
for vtk_model in mono_viewer.UI.vtk_models:
assert vtk_model.actor.GetProperty().GetOpacity() == 1
def test_opacity_slider_for_incorrect_opacity(qtbot):
mono_viewer = Viewers.MonoViewer('tests/data/test_video.avi')
qtbot.addWidget(mono_viewer)
vtk_model_path = 'inputs/Liver'
vtk_model_loader = VTKSurfaceModelDirectoryLoader(vtk_model_path)
mono_viewer.add_VTK_models(vtk_model_loader.models)
mono_viewer.start()
mono_viewer.UI.opacity_slider.setSliderPosition(0)
for vtk_model in mono_viewer.UI.vtk_models:
assert vtk_model.actor.GetProperty().GetOpacity() != 0.5
def test_model_visibilty_toggle(mono_viewer):
for vtk_model in mono_viewer.UI.vtk_models:
vtk_model.toggle_visibility()
assert vtk_model.actor.GetVisibility() == 0
vtk_model.toggle_visibility()
assert vtk_model.actor.GetVisibility() == 1
\ No newline at end of file
import os
import sys
import pytest
import numpy as np
from sksurgeryardavinci.widgets import Viewers
......@@ -5,7 +7,7 @@ from sksurgeryutils.common_overlay_apps import OverlayOnVideoFeed
# pyint:disable=line-too-long
# GUI tests causing error on Linux CI-machine.
if os.environ.get('GITLAB_CI')=='True':
if os.environ.get('GITLAB_CI')=='True' and sys.platform == "linux":
pytest.skip("skipping GUI tests on linux CI", allow_module_level=True)
@pytest.fixture(scope="module")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment