borgbase / vorta

Desktop Backup Client for Borg Backup
https://vorta.borgbase.com
GNU General Public License v3.0
2k stars 133 forks source link

flaky "tests/test_repo.py::test_ssh_dialog" in 0.8.3 #1258

Open sten0 opened 2 years ago

sten0 commented 2 years ago

Hi,

In the interest of helping to prepare for 0.8.4, I thought I'd mention this flaky test (if you think it's fixed in HEAD, please let me know, and I'll upload to Debian experimental to gain the benefit of early CI). I'm reporting it in case it's something Vorta can and should work around.

…
tests/test_repo.py::test_repo_add_success PASSED
tests/test_repo.py::test_ssh_dialog Exceptions caught in Qt event loop:
________________________________________________________________________________
Traceback (most recent call last):
  File "/build/vorta-0.8.3/.pybuild/cpython3_3.9_vorta/build/vorta/views/archive_tab.py", line 262, in list_result
    self.populate_from_profile()
  File "/build/vorta-0.8.3/.pybuild/cpython3_3.9_vorta/build/vorta/views/archive_tab.py", line 141, in populate_from_profile
    profile = self.profile()
  File "/build/vorta-0.8.3/.pybuild/cpython3_3.9_vorta/build/vorta/store/models.py", line 188, in profile
    return BackupProfileModel.get(id=self.window().current_profile.id)
AttributeError: 'QWidget' object has no attribute 'current_profile'
________________________________________________________________________________
ERROR
tests/test_repo.py::test_create PASSED
…
tests/network_manager/test_network_manager.py::test_decode_ssid[ssid_bytes2-\\x00\\x01\\x02\\n"'] PASSED

==================================== ERRORS ====================================
______________________ ERROR at setup of test_ssh_dialog _______________________
SETUP ERROR: Exceptions caught in Qt event loop:
________________________________________________________________________________
Traceback (most recent call last):
  File "/build/vorta-0.8.3/.pybuild/cpython3_3.9_vorta/build/vorta/views/archive_tab.py", line 262, in list_result
    self.populate_from_profile()
  File "/build/vorta-0.8.3/.pybuild/cpython3_3.9_vorta/build/vorta/views/archive_tab.py", line 141, in populate_from_profile
    profile = self.profile()
  File "/build/vorta-0.8.3/.pybuild/cpython3_3.9_vorta/build/vorta/store/models.py", line 188, in profile
    return BackupProfileModel.get(id=self.window().current_profile.id)
AttributeError: 'QWidget' object has no attribute 'current_profile'
________________________________________________________________________________
=========================== short test summary info ============================
ERROR tests/test_repo.py::test_ssh_dialog
========================= 68 passed, 1 error in 52.07s =========================
…

https://tests.reproducible-builds.org/debian/rbuild/bookworm/amd64/vorta_0.8.3-1.rbuild.log.gz

Kind regards, Nicholas

real-yfprojects commented 2 years ago

https://github.com/borgbase/vorta/blob/fb5a24f66d09637b3b49712fdbc522a7ab13c32b/src/vorta/store/models.py#L190-L191

This line is very dirty. Luckily BorgJob inherits BackupProfileMixin without using profile(). BorgJob is only a subclass of QObject although only subclasses of QWidget have the attribute window(). I think the reason for this test fail is a qt bug.

sten0 commented 2 years ago

Hi!

Thank you for the quick reply :-)

yfprojects @.***> writes:

https://github.com/borgbase/vorta/blob/fb5a24f66d09637b3b49712fdbc522a7ab13c32b/src/vorta/store/models.py#L190-L191

This line is very dirty. Luckily BorgJob inherits BackupProfileMixin without using profile(). BorgJob is only a subclass of QObject although only subclasses of QWidget have the attribute window(). I think the reason for this test fail is a qt bug.

So there's nothing Vorta can do to mitigate the Qt bug, for example by being less "dirty"?

I've also considered using QT_QPA_PLATFORM=offscreen rather than xvfb-run dbus-run-session, but I suspect it wouldn't support button click events.

real-yfprojects commented 2 years ago

So there's nothing Vorta can do to mitigate the Qt bug, for example by being less "dirty"?

Yes, there is. A little refactoring should do the job.

I've also considered using QT_QPA_PLATFORM=offscreen rather than xvfb-run dbus-run-session, but I suspect it wouldn't support button click events.

Although some qt internal warnings are displayed all the tests pass.

sten0 commented 2 years ago

So there's nothing Vorta can do to mitigate the Qt bug, for example by being less "dirty"?

Yes, there is. A little refactoring should do the job.

Fiouf, that's good news :) Would it be possible to schedule a late October soft deadline for this? That's usually about a month before a big Python release that breaks everything, and I'm hoping that late 2022 early 2023 can be less stressful than this last year.

I've also considered using QT_QPA_PLATFORM=offscreen rather than xvfb-run dbus-run-session, but I suspect it wouldn't support button click events.

Although some qt internal warnings are displayed all the tests pass.

Good to know :) I sounds like xvfb-run is marginally "better" for now though.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.