Merge ~jocave/plainbox-provider-checkbox:always-cleanup-conns into plainbox-provider-checkbox:master

Proposed by Jonathan Cave
Status: Merged
Approved by: Jonathan Cave
Approved revision: 398a3e02703b81a1e70699c072ed8cf7bef55f71
Merged at revision: cc7ed71fd7860669ac9bf862fe1fc032d899f84c
Proposed branch: ~jocave/plainbox-provider-checkbox:always-cleanup-conns
Merge into: plainbox-provider-checkbox:master
Diff against target: 13 lines (+1/-1)
1 file modified
bin/wifi_nmcli_test.py (+1/-1)
Reviewer Review Type Date Requested Status
Sylvain Pineau Approve
Jonathan Cave (community) Needs Resubmitting
Review via email: mp+375277@code.launchpad.net

Description of the change

During testing of lp:1765350 Ray noticed that connections were not being cleaned up anymore and hence devices were staying connected to the test APs. This should ensure the clean up is always run.

To post a comment you must log in.
Revision history for this message
Sheila Miguez (codersquid) wrote :

In case the func will fail, maybe kept the 'try' and have the cleanup in the 'finally' clause.

Revision history for this message
Jonathan Cave (jocave) wrote :

This is what I did previously, but removed. I don't really get why. Was it just because of this sys.exit() move?

https://git.launchpad.net/plainbox-provider-checkbox/commit/bin/wifi_nmcli_test.py?id=7379c3755af212dd7926bb090f66a07e81e640db

Revision history for this message
Sheila Miguez (codersquid) wrote :

Maybe? But I think you'd want a try/finally clause regardless. It will be called on failures or successes. If you don't need to do anything for exceptions, you can leave out the except clause.

Revision history for this message
Jonathan Cave (jocave) wrote :

Yep, sorry for me questioning myself through an MR! Putting back the finally...

review: Needs Resubmitting
Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/bin/wifi_nmcli_test.py b/bin/wifi_nmcli_test.py
2index 5e5cb6e..71f01c9 100755
3--- a/bin/wifi_nmcli_test.py
4+++ b/bin/wifi_nmcli_test.py
5@@ -221,7 +221,7 @@ if __name__ == '__main__':
6 if args.func:
7 try:
8 result = args.func(args)
9- except:
10+ finally:
11 cleanup_nm_connections()
12
13 # The test is not required to run as root, but root access is required for

Subscribers

People subscribed via source and target branches