test_sksurgerycore.py 1.17 KB
Newer Older
Matt Clarkson's avatar
Matt Clarkson committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
# coding=utf-8

"""scikit-surgerycore tests"""

from sksurgerycore.ui.sksurgerycore_demo import run_demo

import six

# Pytest style

def test_using_pytest_sksurgerycore():
    console = True
    assert run_demo(console, "Hello World") == True

# Disable this test if root.mainloop is uncommented in
# run_demo()
def test_using_pytest_cookienewwithgitinit_withTK():
    try:
        import tkinter
        try:
            console=False
            assert run_demo(console, "Hello World") == True
        except tkinter.TclError:
            six.print_("Got TCL error, probably no DISPLAY set, that's OK.")
            assert True
        except:
            six.print_("Got another error (not TCL), that's not OK.")
            assert False

30 31
    #except ModuleNotFoundError:
        #six.print_("Got module not found on tkinter, please check your python installation")
Matt Clarkson's avatar
Matt Clarkson committed
32
        #we're not trying to test whether we have tkinter so this is ok
33
        #assert True
Matt Clarkson's avatar
Matt Clarkson committed
34 35 36 37 38 39 40
    except ImportError:
        six.print_("Got import error on tkinter, please check your python installation")
        #we're not trying to test whether we have tkinter so this is ok
        assert True
    except:
        assert False