napari / napari

napari: a fast, interactive, multi-dimensional image viewer for python
https://napari.org
BSD 3-Clause "New" or "Revised" License
2.08k stars 411 forks source link

Fix `pytest.fail` msg in `fail_obj_graph` #6898

Closed lucyleeow closed 3 weeks ago

lucyleeow commented 3 weeks ago

References and relevant issues

6842

Description

This was amended in #6842 but pytest.fail msg needs to be a string.

Noted in failed CI: https://github.com/napari/napari/actions/runs/8932333235/job/24536346859?pr=6848#step:12:520 from #6848 :

               # DO not remove len, this can break as C++ obj are gone, but python objects
              # still hang around and _repr_ would crash.
  >           pytest.fail(len(Klass._instances))
  E           TypeError: Failed expected string as 'msg' parameter, got 'int' instead.
  E           Perhaps you meant to use a mark?
lucyleeow commented 3 weeks ago

Thanks @Czaki https://github.com/napari/napari/pull/6899 is better, closing.