pcdshub / lightpath

LCLS Lightpath Module
https://pcdshub.github.io/lightpath
Other
4 stars 9 forks source link

WIP/TST: start by removing one test #154

Closed tangkong closed 2 years ago

tangkong commented 2 years ago

Description

poking around to try and fix the qthread teardown errors. I saw a slightly more verbose error message that led me to think that maybe I could fix thix

Seen in the docs PR checks:

Unable to remove connection for <PyDMChannel (sig://five_current_state)>
Traceback (most recent call last):
  File "/home/travis/virtualenv/python3.9.6/lib/python3.9/site-packages/pydm/widgets/channel.py", line 130, in disconnect
    plugin.remove_connection(self, destroying=destroying)
  File "/home/travis/virtualenv/python3.9.6/lib/python3.9/site-packages/pydm/data_plugins/plugin.py", line 239, in remove_connection
    self.connections[connection_id].deleteLater()
RuntimeError: wrapped C/C++ object of type SignalConnection has been deleted
Unable to remove connection for <PyDMChannel (sig://five_current_destination)>
Traceback (most recent call last):
  File "/home/travis/virtualenv/python3.9.6/lib/python3.9/site-packages/pydm/widgets/channel.py", line 130, in disconnect
    plugin.remove_connection(self, destroying=destroying)
  File "/home/travis/virtualenv/python3.9.6/lib/python3.9/site-packages/pydm/data_plugins/plugin.py", line 239, in remove_connection
    self.connections[connection_id].deleteLater()
RuntimeError: wrapped C/C++ object of type SignalConnection has been deleted
QThread: Destroyed while thread is still running
/home/travis/.travis/functions: line 109:  5917 Aborted                 pytest "${PYTEST_ARGS[@]}"

Motivation and Context

138

How Has This Been Tested?

Here is where I abuse travis

Where Has This Been Documented?

This PR

tangkong commented 2 years ago

QThread errors don't appear if test_gui.py is omitted. 🎉

We do get another teardown-related error, but it doesn't cause the test suite to fail. This is the error I thought was going to give me a lead but it turned out not to be the case. (I originally omitted the only test that used sim device five, but the QThread issues persisted)

Unable to remove connection for <PyDMChannel (sig://five_current_destination)>
Traceback (most recent call last):
  File "/home/travis/virtualenv/python3.9.6/lib/python3.9/site-packages/pydm/widgets/channel.py", line 130, in disconnect
    plugin.remove_connection(self, destroying=destroying)
  File "/home/travis/virtualenv/python3.9.6/lib/python3.9/site-packages/pydm/data_plugins/plugin.py", line 239, in remove_connection
    self.connections[connection_id].deleteLater()
RuntimeError: wrapped C/C++ object of type SignalConnection has been deleted
tangkong commented 2 years ago

A bunch of stupid commits later, I've narrowed this down to test_typhos_display. I thought it might have somenthing to do with the typhos widget/screen not being collected by qtbot, but I tried adding it and the error still persists.

tangkong commented 2 years ago

I've narrowed it down to the creation of the typhos detailed screen. If we never call show_detailed, we can get through the test suite without any QThread teardown issues.

I'll have to find some way other than qtbot to clean this test up..

klauer commented 2 years ago

lightpath bug? typhos bug? pcdsdevices bug? PyDM bug... ?

Seems reasonable to point the finger at typhos - it shouldn't have a problem with its displays being deleted. Perhaps it has to do with the callback cache deleting it too quickly or something.

tangkong commented 2 years ago

It was our fault all along. Creating a PyDMApplication (QApplication) without looking for a global instance caused issues. I'm going to close this and add the fix to another PR that was experiencing different issues due to the same misstep.

tangkong commented 2 years ago

In a flurry of qt debugging, we tracked this down to an issue within typhos that has been resolved. (https://github.com/pcdshub/typhos/pull/516)

Closing this for now. If the bug is still present, well we'll cross that bridge when we get there.