pyface icon indicating copy to clipboard operation
pyface copied to clipboard

test_focus failure on macOS

Open mdickinson opened this issue 3 years ago • 3 comments

test_focus consistently fails for me on macOS when run as part of the whole test suite using etstool. Following a python etstool.py install and a python etstool.py test, I get this output:

======================================================================
FAIL: test_focus (pyface.tests.test_widget.TestConcreteWidget)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/mdickinson/.edm/envs/pyface-test-3.6-pyqt5/lib/python3.6/site-packages/pyface/tests/test_widget.py", line 333, in test_focus
    self.assertFalse(self.widget.has_focus())
AssertionError: True is not false

----------------------------------------------------------------------
Ran 1196 tests in 56.754s

FAILED (failures=1, skipped=60)

This test is apparently already skipped on Linux and Windows. I couldn't find any issue associated with that skip; I think if there isn't one, we should open one (or repurpose this one) and add that issue reference to the skip message.

mdickinson avatar Sep 17 '21 09:09 mdickinson

Is this on an actual desktop, or on CI.

If it is an actual desktop then you cannot be using the machine for anything else while the test runs (in particular I think that the Python process needs to be active while the test runs, and you can't do any spurious interactions). Because the focus is heavily dependent on user interaction, this test is necessarily fragile. It should work fine in CI where there is no user interaction.

I'll double-check that this isn't a regression.

corranwebster avatar Sep 17 '21 09:09 corranwebster

The test suite runs cleanly for me on current main branch for Mac OS 10.15 and both PyQt5 and PySide2. The tests were run using python etstool.py test-clean --toolkit=pyqt5 or equivalent for PySide2

corranwebster avatar Sep 17 '21 09:09 corranwebster

On a desktop. Yes, it runs fine if I don't try to do anything else while the test suite is running.

Can we make this more robust somehow? Or find a way to skip it if not running under CI? Or add something in the error message indicating that a failure when run on a desktop machine is likely a false positive? It would be good to avoid spurious test failures if they don't represent a real issue.

Any idea why this test needs to be skipped on Linux and Windows CI?

mdickinson avatar Sep 17 '21 09:09 mdickinson