Commit 01b8b9c9 authored by t's avatar t
Browse files

Remove UI tests

parent 7f382889
Pipeline #1404 failed with stages
in 14 minutes
......@@ -4,13 +4,64 @@ variables:
PYPI_PASS: SECURE
stages:
- build
- installer
- test
- deploy
build docs:
stage: build
script:
- tox -e docs
tags:
- shared-linux
artifacts:
paths:
- doc/
expire_in: 1 week
build linux installer:
stage: build
script:
- tox -e installer
tags:
- shared-linux
artifacts:
paths:
- dist/
expire_in: 1 week
build mac installer:
stage: build
script:
- tox -e installer
tags:
- shared-mac
artifacts:
paths:
- dist/
expire_in: 1 week
build windows installer:
stage: build
script:
- tox -e installer
tags:
- shared-win, gui
artifacts:
paths:
- dist/
expire_in: 1 week
test Linux:
stage: test
variables:
LD_LIBRARY_PATH: ${CI_PROJECT_DIR}/.tox/py36/lib/python3.6/site-packages/PySide2/Qt/plugins/platforms
DISPLAY: localhost:0
DISPLAY: localhost:1
script:
- echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}"
- echo "DISPLAY=${DISPLAY}"
......@@ -32,4 +83,65 @@ test Windows:
script:
- tox
tags:
- shared-win
\ No newline at end of file
- shared-win
deploy docs to staging:
stage: deploy
script:
# Note: the group/username directory must already exist on the server before calling this command
- rsync -avz -e'ssh -v' --numeric-ids --delete doc/build/html/* staging_docs_rsync:WEISS/SoftwareRepositories/SNAPPY/scikit-surgeryARDavinci 2>&1
tags:
- docs-staging
environment:
name: staging
url: http://weisslab-lin.cs.ucl.ac.uk/staging/WEISS/SoftwareRepositories/SNAPPY/scikit-surgeryARDavinci
only:
- master
dependencies:
- build docs
deploy docs to production:
stage: deploy
script:
# Note: the group/username directory must already exist on the server before calling this command
- rsync -avz -e'ssh -v' --numeric-ids --delete doc/build/html/* production_docs_rsync:WEISS/SoftwareRepositories/SNAPPY/scikit-surgeryARDavinci 2>&1
tags:
- docs-production
environment:
name: production
only:
- public
dependencies:
- build docs
deploy pip to PyPI:
stage: deploy
when: manual
only:
- tags
environment:
name: PyPI
url: https://pypi.python.org/pypi/scikit-surgeryARDavinci
tags:
- pip-production
artifacts:
paths:
- dist/
script:
# Install packages required to build/publish
# remove any previous distribution files
- pip install wheel twine setuptools
- rm -rf dist
# bundle installer
- python setup.py bdist_wheel
# Upload to pypi
- twine upload --repository pypi dist/* --username $PYPI_USER --password $PYPI_PASS
import pytest
from PySide2.QtWidgets import QApplication
@pytest.fixture(scope="session")
def setup_qt():
""" Create the QT appliation"""
app = QApplication([])
return app
\ No newline at end of file
import pytest
import json
import os
from tests.createTestVideo import create_video_file, remove_video_file
from sksurgeryardavinci.widgets import Viewers
from sksurgeryvtk.widgets.vtk_overlay_window import VTKOverlayWindow
from sksurgeryvtk.models.vtk_surface_model_directory_loader \
import VTKSurfaceModelDirectoryLoader
from PySide2.QtWidgets import QApplication
from PySide2.QtCore import Qt
@pytest.fixture(scope="module")
def video_file_source(setup_qt):
""" Provide video file for subsequent tests"""
video_filename = 'tests/data/test_video.avi'
return video_filename
@pytest.fixture()
def mono_viewer(video_file_source):
# setup
mono_viewer = Viewers.MonoViewer(video_file_source)
vtk_model_path = 'inputs/Liver'
vtk_model_loader = VTKSurfaceModelDirectoryLoader(vtk_model_path)
mono_viewer.add_VTK_models(vtk_model_loader.models)
yield mono_viewer
def test_opacity_slider_for_correct_opacity(mono_viewer):
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(mono_viewer):
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 pytest
import numpy as np
from sksurgeryardavinci.widgets import Viewers
from sksurgeryvtk.widgets.common_overlay_apps import OverlayOnVideoFeed
# pyint:disable=line-too-long
@pytest.fixture(scope="module")
def video_file_source(setup_qt):
""" Provide video file for subsequent tests"""
video_filename = 'tests/data/test_video.avi'
return video_filename
@pytest.fixture(scope="module")
def mock_stereo_widget(video_file_source):
""" Provide video file for subsequent tests"""
mock_stereo = Viewers.MockStereoViewer(video_file_source)
mock_stereo.start()
return mock_stereo
def test_duplicate_window(video_file_source):
""" Check that the duplicate window frame and the source window
frame are the same."""
video_source = OverlayOnVideoFeed(video_file_source)
duplicate_source = Viewers.DuplicateOverlayWindow()
duplicate_source.set_source_window(video_source)
video_source.update()
duplicate_source.update()
np.testing.assert_array_equal(video_source.vtk_overlay_window.rgb_frame,
duplicate_source.vtk_overlay_window.rgb_frame)
def test_mono_viewer(video_file_source):
""" Ensure no errors are thrown. """
mono_viewer = Viewers.MonoViewer(video_file_source)
def test_mock_stereo_cameras_are_synced(mock_stereo_widget):
left_cam = mock_stereo_widget.left_overlay.get_foreground_camera()
right_cam = mock_stereo_widget.right_overlay.get_foreground_camera()
ui_cam = mock_stereo_widget.ui_overlay.get_foreground_camera()
assert left_cam == right_cam
assert left_cam == ui_cam
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