pyface icon indicating copy to clipboard operation
pyface copied to clipboard

pyface/ui/wx/data_view/tests/test_data_wrapper.py tests should be skipped if wx not installed

Open aaronayres35 opened this issue 5 years ago • 3 comments

the tests in this file: https://github.com/enthought/pyface/blob/master/pyface/ui/wx/data_view/tests/test_data_wrapper.py should all be skipped if wx is not installed to avoid the tests failing when running the test suite with a different backend.

This is related to #812. We would want to do something like what is done here: https://github.com/enthought/pyface/blob/92ab7363268ddcf9efde8fc4cdc561b042160e90/pyface/ui/wx/grid/tests/test_simple_grid_model.py#L12-L20

aaronayres35 avatar Dec 02 '20 16:12 aaronayres35

I think there are probably many tests like this. On CI, etstool.py sets an environment variable: https://github.com/enthought/pyface/blob/92ab7363268ddcf9efde8fc4cdc561b042160e90/etstool.py#L294-L299 which gets used in load_tests for filtering test suites during unittest discover: https://github.com/enthought/pyface/blob/92ab7363268ddcf9efde8fc4cdc561b042160e90/pyface/init.py#L69 e.g. the test_data_wrapper has a path python.ui.wx.data_view.tests.test_data_wrapper, which would match the (wx) pattern and be skipped.

For me, I don't use etstool.py 99% of the time, so I really dislike the environment variable approach: It means the test suite does not work nicely out of the box unless one knows of this hidden switch. However, see also https://github.com/enthought/pyface/issues/662#issuecomment-671452413

kitchoi avatar Dec 02 '20 17:12 kitchoi

I think there are probably many tests like this.

I just tested with wx and there are many occurrences of failures with ImportError: Cannot import PySide, PySide2, PyQt5 or PyQt4

aaronayres35 avatar Dec 02 '20 17:12 aaronayres35

In this PR that introduces GitHub Actions to TraitsUI, the environment variable is made redundant: https://github.com/enthought/traitsui/pull/1415

I just noticed that the recipes for building EDM eggs also have to set this environment for their tests. So the environment variable setup also affects distribution packagers.

kitchoi avatar Dec 02 '20 17:12 kitchoi