Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix test failures when run against TraitsUI 7.1.0 (#446)
* Add private testing utility modules promote looser coupling * Change importing private module of TraitsUI to importing locally maintained modules * Fix name change from skip_if_not_qt4 to skip_if_not_qt * Unpin TraitsUI and Pyface versions * Remove another duplication
- Loading branch information
Showing
10 changed files
with
99 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# (C) Copyright 2018-2020 Enthought, Inc., Austin, TX | ||
# All rights reserved. | ||
# | ||
# This software is provided without warranty under the terms of the BSD | ||
# license included in LICENSE.txt and may be redistributed only under | ||
# the conditions described in the aforementioned license. The license | ||
# is also available online at http://www.enthought.com/licenses/BSD.txt | ||
# | ||
# Thanks for using Enthought open source! | ||
""" This module contains utilities for testing within Enable. | ||
This is not a public module and should not to be used outside of Enable. | ||
""" | ||
import unittest | ||
|
||
from traits.etsconfig.api import ETSConfig | ||
|
||
|
||
def is_wx(): | ||
""" Return true if the toolkit backend is wx. """ | ||
return ETSConfig.toolkit == "wx" | ||
|
||
|
||
def is_qt(): | ||
""" Return true if the toolkit backend is Qt | ||
(that includes Qt4 or Qt5, etc.) | ||
""" | ||
return ETSConfig.toolkit.startswith("qt") | ||
|
||
|
||
def is_null(): | ||
""" Return true if the toolkit backend is null. | ||
""" | ||
return ETSConfig.toolkit == "null" | ||
|
||
|
||
skip_if_null = unittest.skipIf( | ||
is_null(), | ||
"Test not working on the 'null' backend" | ||
) | ||
|
||
skip_if_not_qt = unittest.skipIf(not is_qt(), "Test only for qt") | ||
|
||
|
||
skip_if_not_wx = unittest.skipIf(not is_wx(), "Test only for wx") | ||
|
||
|
||
def get_dialog_size(ui_control): | ||
"""Return the size of the dialog. | ||
Return a tuple (width, height) with the size of the dialog in pixels. | ||
E.g.: | ||
>>> get_dialog_size(ui.control) | ||
""" | ||
|
||
if is_wx(): | ||
return ui_control.GetSize() | ||
|
||
elif is_qt(): | ||
return ui_control.size().width(), ui_control.size().height() | ||
|
||
raise RuntimeError("Unable to compute dialog size. Unknown toolkit.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# (C) Copyright 2018-2020 Enthought, Inc., Austin, TX | ||
# All rights reserved. | ||
# | ||
# This software is provided without warranty under the terms of the BSD | ||
# license included in LICENSE.txt and may be redistributed only under | ||
# the conditions described in the aforementioned license. The license | ||
# is also available online at http://www.enthought.com/licenses/BSD.txt | ||
# | ||
# Thanks for using Enthought open source! | ||
""" This module contains utilities for testing within Kiva. | ||
This is not a public module and should not to be used outside of Kiva. | ||
""" | ||
|
||
import unittest | ||
|
||
from traits.etsconfig.api import ETSConfig | ||
|
||
|
||
def is_wx(): | ||
""" Return true if the toolkit backend is wx. """ | ||
return ETSConfig.toolkit == "wx" | ||
|
||
|
||
skip_if_not_wx = unittest.skipIf(not is_wx(), "Test only for wx") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters