Skip to content

"RuntimeError: Internal C++ object (PyDMShellCommand) already deleted" error occurs sometimes when running pyside6 tests #1267

@nstelter-slac

Description

@nstelter-slac

Describe the bug

The following occurs sometimes when running tests (python run_tests.py) with pyside6.
I've not seen this when running outside the tests, so not sure if pytest specific issue of indicative of actual pydm issue.

pydm/tests/widgets/test_waveform_plot.py::test_redrawPlot_without_crosshair Exceptions caught in Qt event loop:


Traceback (most recent call last):
File "/home/nolan_work/repos/pydm/pydm/widgets/shell_command.py", line 839, in
lambda: self._check_process_done(action, original_button_text, original_action_text)
~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/nolan_work/repos/pydm/pydm/widgets/shell_command.py", line 884, in _check_process_done
self.set_object_font_italic(self, False)
~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
File "/home/nolan_work/repos/pydm/pydm/widgets/shell_command.py", line 909, in set_object_font_italic
font = object.font()
RuntimeError: Internal C++ object (PyDMShellCommand) already deleted.


Exceptions caught in Qt event loop:


Traceback (most recent call last):
File "/home/nolan_work/repos/pydm/pydm/widgets/shell_command.py", line 839, in
lambda: self._check_process_done(action, original_button_text, original_action_text)
~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/nolan_work/repos/pydm/pydm/widgets/shell_command.py", line 884, in _check_process_done
self.set_object_font_italic(self, False)
~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
File "/home/nolan_work/repos/pydm/pydm/widgets/shell_command.py", line 909, in set_object_font_italic
font = object.font()
RuntimeError: Internal C++ object (PyDMShellCommand) already deleted.


FAILED

Steps to reproduce

  1. create conda env with python 3.13 and pyside6:
  $ conda create -n pydm-environment-pyside python pip numpy scipy six psutil pyqtgraph pydm -c conda-forge
  $ source activate pydm-environment
  $ pip install PySide6 # or can install with conda in earlier cmd
  1. edit run_tests.py to not run "test_psp_plugin_component.py" and "test_plugins_import.py"
--- a/run_tests.py
+++ b/run_tests.py
@@ -23,6 +23,8 @@ if __name__ == "__main__":
         args.append("--ignore=pydm/tests/data_plugins/test_p4p_plugin_component.py")
         args.append("--ignore=pydm/tests/data_plugins/test_psp_plugin_component.py")
 
+    args.append("--ignore=pydm/tests/data_plugins/test_psp_plugin_component.py")
+    args.append("--ignore=pydm/tests/test_plugins_import.py")
     print("pytest arguments: {}".format(args))
 
     sys.exit(pytest.main(args))
  1. activate conda pyside6 env and export QT_API=pyside6

  2. run python run_tests.py a few times until see the failure. (we should try do something to make this fail every-time for debugging)

Expected behavior

tests never hit this error.

Operating System.

Linux

OS Version Details.

No response

Python Version

Python 3.13.5

Packages Version

Image

Additional context.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpyside6for adding pyside6 (qt6) support

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions