Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
WEISS
Software Repositories
SNAPPY
scikit-surgerydavinci
Commits
60c67797
Commit
60c67797
authored
Feb 17, 2019
by
Thomas Dowrick
Browse files
Fix tests linux
parent
d1de167a
Changes
5
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
60c67797
...
...
@@ -83,7 +83,7 @@ test Windows:
script
:
-
tox
tags
:
-
shared-win
-
shared-win
, gui
deploy docs to staging
:
...
...
tests/test_UI.py
View file @
60c67797
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
...
...
tests/test_Viewers.py
View file @
60c67797
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
()
...
...
tests/test_placholder.py
0 → 100644
View file @
60c67797
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
tox.ini
View file @
60c67797
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment