Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove a test that uses UITester #1788

Merged
merged 3 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,9 @@ def get_long_description():
],
"test": [
"Cython",
# defusedxml is required by the Sphinx test machinery
# for recent versions of Sphinx (including 7.3.7)
"defusedxml",
"flake8",
"flake8-ets",
"mypy",
Expand Down
28 changes: 10 additions & 18 deletions traits/tests/test_enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@
from traits.api import (
Any, BaseEnum, Enum, HasTraits, Int, List, Property, Set, TraitError,
Tuple)
from traits.etsconfig.api import ETSConfig
from traits.testing.optional_dependencies import requires_traitsui

is_null = ETSConfig.toolkit == 'null'


class FooEnum(enum.Enum):
foo = 0
Expand Down Expand Up @@ -115,13 +112,6 @@ class EnumCollectionExample(HasTraits):
slow_enum = BaseEnum("yes", "no", "maybe")


class EnumCollectionGUIExample(EnumCollectionExample):
# Override attributes that may fail GUI test
# until traitsui #781 is fixed.
int_set_enum = Enum("int", "set")
correct_int_set_enum = Enum("int", "set")


class EnumTestCase(unittest.TestCase):
def test_valid_enum(self):
example_model = ExampleModel(root="model1")
Expand Down Expand Up @@ -343,12 +333,14 @@ class HasEnumInList(HasTraits):


@requires_traitsui
@unittest.skipIf(is_null, "GUI toolkit not available")
class TestGui(unittest.TestCase):

class TestEnumCreateEditor(unittest.TestCase):
def test_create_editor(self):
from traitsui.testing.api import UITester

obj = EnumCollectionGUIExample()
with UITester().create_ui(obj):
pass
import traitsui.editor_factory

obj = EnumListExample()
trait = obj.trait("value")
editor_factory = trait.trait_type.create_editor()
self.assertIsInstance(
editor_factory,
traitsui.editor_factory.EditorFactory
)
Loading