enthought / traits

Observable typed attributes for Python classes
Other
432 stars 85 forks source link

Tests fail with latest Traits and TraitsUI from PyPI #1748

Open mdickinson opened 1 year ago

mdickinson commented 1 year ago

I'm seeing a test failure with the latest Traits and TraitsUI from PyPI, on Python 3.11. (I haven't tested with other Python versions, but it likely affects those, too.)

Steps to reproduce:

Expected results: the test suite runs to completion.

Actual results: we get the following test failure:

======================================================================
FAIL: test_edit_not_given (traits.tests.test_configure_traits.TestConfigureTraits.test_edit_not_given)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/mdickinson/.venvs/traits/lib/python3.11/site-packages/traits/tests/test_configure_traits.py", line 158, in test_edit_not_given
    self.assertEqual(len(captured_warnings), 0)
AssertionError: 2 != 0

----------------------------------------------------------------------

This is likely to be an overzealous test, but as well as tightening this test, we should investigate what the warnings are, where they're coming from, and how we can fix them.

mdickinson commented 1 year ago

The warnings are both the same:

(Pdb) p [warning.message for warning in captured_warnings]
[DeprecationWarning("traitsui.__version__ is deprecated, use impportlib.metadata.version('traitsui') "), DeprecationWarning("traitsui.__version__ is deprecated, use impportlib.metadata.version('traitsui') ")]

We've already updated the Traits main branch not to use traitsui.__version__, but there hasn't been a Traits release since; these CI jobs will only stop failing when we make a Traits release.

Separately, we should fix the test so that it doesn't fail on unrelated warnings.