Commit 7d790e05 authored by Thomas Dowrick's avatar Thomas Dowrick
Browse files

Merge branch 'fix-tests-linux' into 'master'

Fix tests linux

See merge request WEISS/SoftwareRepositories/SNAPPY/scikit-surgeryardavinci!1
parents d1de167a 60c67797
......@@ -83,7 +83,7 @@ test Windows:
script:
- tox
tags:
- shared-win
- shared-win, gui
deploy docs to staging:
......
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.
# in_gitlab_ci = str(os.environ.get('GITLAB_CI'))
# print("Gitlab_CI: " + in_gitlab_ci)
# if sys.platform == "linux" and in_gitlab_ci:
# 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')
......@@ -16,7 +24,16 @@ def mono_viewer(qtbot):
return mono_viewer
def test_opacity_slider_for_correct_opacity(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
......@@ -30,7 +47,15 @@ def test_opacity_slider_for_correct_opacity(mono_viewer):
assert vtk_model.actor.GetProperty().GetOpacity() == 1
def test_opacity_slider_for_incorrect_opacity(mono_viewer):
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
......
import os
import sys
import pytest
import numpy as np
from sksurgeryardavinci.widgets import Viewers
from sksurgeryutils.common_overlay_apps import OverlayOnVideoFeed
# pyint:disable=line-too-long
# # GUI tests causing error on Linux CI-machine.
# in_gitlab_ci = str(os.environ.get('GITLAB_CI'))
# print("Gitlab_CI" + in_gitlab_ci)
# if sys.platform == "linux" and in_gitlab_ci:
# pytest.skip("skipping GUI tests on linux CI", allow_module_level=True)
@pytest.fixture(scope="module")
def video_file_source():
""" Provide video file for subsequent tests"""
......@@ -23,7 +31,6 @@ def test_mock_stereo_cameras_are_synced(qtbot):
mock_stereo.start()
left_cam = mock_stereo.left_overlay.get_foreground_camera()
right_cam = mock_stereo.right_overlay.get_foreground_camera()
ui_cam = mock_stereo.ui_overlay.get_foreground_camera()
......
import pytest
"""
Coverage tool causes CI error if no tests are run.
As I'm disabling tests when running on Gitlab-CI, need to have at
least one that will run.
"""
def test_pass():
assert True
\ No newline at end of file
......@@ -8,6 +8,7 @@ python =
3.6: py36, docs, lint
[testenv]
passenv = *
deps=-rrequirements-dev.txt
whitelist_externals=coverage,pip
# See .coveragerc for list of omitted files
......
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