Changeset f0e9ee1
- Timestamp:
- 2021-03-26T11:03:36Z (4 years ago)
- Children:
- a3a966a
- Parents:
- 4b15a9a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
.tests/test1.py
r4b15a9a rf0e9ee1 96 96 return received 97 97 98 def perform_test(failed, clis, test_function, test_name): 99 fail = False 98 def debug_check(debug_file): 99 error_found = False 100 debug_log = '' 101 while True: 102 line = readline(debug_file) 103 if len(line) == 0: 104 break 105 debug_log += line 106 error_found = error_found or (line.lower().find('error') != -1) 107 return error_found, debug_log 108 109 def perform_test(failed, clis, test_function, test_name, debug_file): 100 110 for cli in clis: 101 111 cli.tmplog="" … … 104 114 print("Test: "+test_name) 105 115 106 if test_function(clis): 107 print("Test passed") 108 else: 116 fail = not test_function(clis) 117 118 debug_error, debug_log = debug_check(debug_file) 119 120 fail = fail or debug_error 121 122 if fail: 109 123 print("Test failed") 110 124 failed += [test_name] 111 fail = True 125 else: 126 print("Test passed") 127 112 128 for cli in clis: 113 129 cli.receive() … … 119 135 print("Test Log "+ cli.nick+":") 120 136 print(cli.tmplog) 137 138 if debug_error: 139 print(SMOLPARATOR) 140 print("Debug Log:") 141 print(debug_log) 142 121 143 print(SEPARATOR) 122 144 … … 250 272 251 273 def run_tests(failed): 274 debug_file = open('debuglog','r') 252 275 clis = [] 253 276 clis += [IrcClient('test1', 'asd')] … … 256 279 cli.connect() 257 280 258 perform_test(failed, clis, yes_test, "Yes" )281 perform_test(failed, clis, yes_test, "Yes", debug_file) 259 282 260 283 print("") … … 262 285 cli.jabber_login() 263 286 264 perform_test(failed, clis, add_buddy_test, "Add/remove buddy" )265 perform_test(failed, clis, message_test, "Send message" )266 #perform_test(failed, clis, block_test, "Block user" )267 perform_test(failed, clis, rename_test, "Rename user" )268 perform_test(failed, clis, status_test, "Change status" )269 perform_test(failed, clis, offline_test, "Go offline" )270 perform_test(failed, clis, default_target_test, "Change default target" )271 perform_test(failed, clis, help_test, "Ask for help" )287 perform_test(failed, clis, add_buddy_test, "Add/remove buddy", debug_file) 288 perform_test(failed, clis, message_test, "Send message", debug_file) 289 #perform_test(failed, clis, block_test, "Block user", debug_file) 290 perform_test(failed, clis, rename_test, "Rename user", debug_file) 291 perform_test(failed, clis, status_test, "Change status", debug_file) 292 perform_test(failed, clis, offline_test, "Go offline", debug_file) 293 perform_test(failed, clis, default_target_test, "Change default target", debug_file) 294 perform_test(failed, clis, help_test, "Ask for help", debug_file) 272 295 273 296 if failed or SHOWLOG: … … 286 309 print("\n" + SEPARATOR + "\nAll tests have passed") 287 310 311 debug_file.close() 312 288 313 if __name__ == "__main__": 289 314 failed = []
Note: See TracChangeset
for help on using the changeset viewer.