enthought / enthought/traitsui

Fallback editor used upon import failure, leading to obscure errors

Open
#864 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
306
Forks
99
PR merge metrics
No merged PRs in 30d

Description

The tests in `traitsui.wx.tests.test_table_editor` (when run on their own, not with the entire test suite) produce an error like this:
```
======================================================================
ERROR: test_filtered_table_editor (traitsui.tests.editors.test_table_editor.TestTableEditor)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/kchoi/Work/ETS/traitsui/traitsui/tests/editors/test_table_editor.py", line 288, in test_filtered_table_editor
filter = ui.get_editors("values")[0].filter
AttributeError: 'SimpleEditor' object has no attribute 'filter'
```

The `SimpleEditor` there is actually an instance of `traitsui.wx.editor_factory.SimpleEditor`, where we expected `traitsui.wx.table_editor.TableEditor`.
Somehow, the failure to import `traitsui.wx.table_editor` (see #863) has led to the `SimpleEditor` from `editor_factory` to be used instead.

This leads to rather obscure failure mode. I am not sure why the fallback is necessary. If it is not necessary, I would propose removing it and let import errors like this to be propagated truthfully.

Note that this issue is about the more general behaviour of using some default editor as a fallback. The test failures are separate issues.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.