From e3dc1efaa967a806a5ee98f0c0a11b732f87883b Mon Sep 17 00:00:00 2001 From: Volker Birk Date: Thu, 14 Nov 2019 15:39:16 +0100 Subject: [PATCH] option -n: no end --- test/sync_handshake.py | 14 ++++++++++---- test/sync_test.py | 5 +++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/test/sync_handshake.py b/test/sync_handshake.py index 67d28f9..564fe61 100644 --- a/test/sync_handshake.py +++ b/test/sync_handshake.py @@ -110,10 +110,11 @@ class UserInterface(pEp.UserInterface): pEp.sync_handshake_signal.SYNC_NOTIFY_INIT_ADD_OUR_DEVICE, pEp.sync_handshake_signal.SYNC_NOTIFY_INIT_FORM_GROUP ): - end_on.extend([ - pEp.sync_handshake_signal.SYNC_NOTIFY_SOLE, - pEp.sync_handshake_signal.SYNC_NOTIFY_IN_GROUP, - ]) + if isinstance(end_on, list): + end_on.extend([ + pEp.sync_handshake_signal.SYNC_NOTIFY_SOLE, + pEp.sync_handshake_signal.SYNC_NOTIFY_IN_GROUP, + ]) try: if options.reject: self.deliverHandshakeResult(SYNC_HANDSHAKE_REJECTED) @@ -197,6 +198,8 @@ if __name__=="__main__": optParser.add_option("-j", "--multi-threaded", action="store_true", dest="multithreaded", help="use multithreaded instead of single threaded implementation") + optParser.add_option("-n", "--noend", action="store_true", + dest="noend", help="do not end") options, args = optParser.parse_args() if not options.exec_for: @@ -208,6 +211,9 @@ if __name__=="__main__": except TypeError: end_on = (end_on,) + if options.noend: + end_on = (None,) + multithreaded = options.multithreaded run(options.exec_for, options.color) diff --git a/test/sync_test.py b/test/sync_test.py index b8ad700..1083f09 100644 --- a/test/sync_test.py +++ b/test/sync_test.py @@ -89,6 +89,8 @@ if __name__ == "__main__": help="setup environment, then stop") optParser.add_option("-p", "--print", action="store_true", dest="print", help="print sync message trace in inbox") + optParser.add_option("-n", "--noend", action="store_true", dest="noend", + help="do not end") optParser.add_option("-E", "--end-on", dest="notifications", help="end test on these notifications") optParser.add_option("-3", "--third-device", action="store_true", dest="third", @@ -167,6 +169,9 @@ if __name__ == "__main__": try: None in end_on except TypeError: end_on = (end_on,) + elif options.noend: + end_on = (None,) + Phone = Process(target=test_for, args=("Phone", "red", end_on, options.multithreaded)) Laptop = Process(target=test_for, args=("Laptop", "green", end_on,