Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyportaltests: work around potential session close timeout failures #168

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions tests/pyportaltest/test_remotedesktop.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def create_session(
start_session=True,
persist_mode=None,
restore_token=None,
cb_closed_signal=None,
) -> SessionSetup:
params = params or {}
# To make the tests easier, load ScreenCast automatically if we have
Expand Down Expand Up @@ -120,6 +121,9 @@ def create_session_done(portal, task, data):

assert session.get_session_type() == Xdp.SessionType.REMOTE_DESKTOP

if cb_closed_signal:
session.connect("closed", cb_closed_signal)

if outputs:
# open the PW remote by default since we need it anyway for Start()
handle = session.open_pipewire_remote()
Expand Down Expand Up @@ -581,9 +585,6 @@ def test_close_session_signal(self):
Ensure that we get the GObject signal when our session is closed
externally.
"""
params = {"close-after-start": 500}
setup = self.create_session(params=params)
session = setup.session

session_closed_signal_received = False

Expand All @@ -592,8 +593,10 @@ def session_closed(session):
session_closed_signal_received = True
self.mainloop.quit()

session.connect("closed", session_closed)

params = {"close-after-start": 500}
_ = self.create_session(
params=params, cb_closed_signal=session_closed
) # keep SessionResult alive
self.mainloop.run()

assert session_closed_signal_received is True
Loading