Skip to content

Commit

Permalink
Make TasksApplication.gui expect an IGUI interface, not a GUI instance (
Browse files Browse the repository at this point in the history
#301)

* TST : Test that a TraitError is raised

because the TasksApplication expects it's gui trait to be an instance
of GUI object and not an object that supports the IGUI interface

	modified:   envisage/ui/tasks/tests/test_tasks_application.py

* FIX : Make TasksApplication.gui use Supports IGUI

Not Instance GUI

	modified:   envisage/ui/tasks/tasks_application.py
	modified:   envisage/ui/tasks/tests/test_tasks_application.py

* FIX : Readd removed unittest skip decorator

and remove an unused import

	modified:   envisage/ui/tasks/tests/test_tasks_application.py

* CLN : Update test method name

	modified:   envisage/ui/tasks/tests/test_tasks_application.py

* REF : Use Instance, not Supports for gui trait
  • Loading branch information
Poruri Sai Rahul authored Sep 1, 2020
1 parent 8eddfc4 commit d437123
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion envisage/ui/tasks/tasks_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class TasksApplication(Application):
active_window = Instance("envisage.ui.tasks.task_window.TaskWindow")

# The Pyface GUI for the application.
gui = Instance("pyface.gui.GUI")
gui = Instance("pyface.i_gui.IGUI")

# Icon for the whole application. Will be used to override all taskWindows
# icons to have the same.
Expand Down
13 changes: 13 additions & 0 deletions envisage/ui/tasks/tests/test_tasks_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,20 @@

from envisage.ui.tasks.api import TasksApplication
from envisage.ui.tasks.tasks_application import DEFAULT_STATE_FILENAME
from pyface.i_gui import IGUI
from traits.api import HasTraits, provides

requires_gui = unittest.skipIf(
os.environ.get("ETS_TOOLKIT", "none") in {"null", "none"},
"Test requires a non-null GUI backend",
)


@provides(IGUI)
class DummyGUI(HasTraits):
pass


@requires_gui
class TestTasksApplication(unittest.TestCase):
def setUp(self):
Expand Down Expand Up @@ -119,3 +126,9 @@ def test_layout_load_pickle_protocol_3(self):

state = app._state
self.assertEqual(state.previous_window_layouts[0].size, (492, 743))

def test_gui_trait_expects_IGUI_interface(self):
# Trivial test where we simply set the trait
# and the test passes because no errors are raised.
app = TasksApplication()
app.gui = DummyGUI()

0 comments on commit d437123

Please sign in to comment.