[ https://issues.apache.org/jira/browse/DISPATCH-2063?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jiri Daněk updated DISPATCH-2063: --------------------------------- Description: {code} def dump(self): print(self) sys.stdout.flush() @property def __str__(self): lines = [self.title] for ts, msg in self.logs: lines.append("%s %s" % (ts, msg)) res = str('\n'.join(lines)) return res {code} When dump() runs, Python's print() looks for a __str__ attribute on the argument, it finds it and tries to call it (as a function). But here it is a property which evaluates to a string, so this all fails with {noformat} 71: ====================================================================== 71: ERROR: test_01_concurrent_requests (system_tests_http1_adaptor.Http1AdaptorEdge2EdgeTest) 71: Test multiple concurrent clients sending streaming messages 71: ---------------------------------------------------------------------- 71: Traceback (most recent call last): 71: File "/home/jdanek/repos/qpid/qpid-dispatch/tests/http1_tests.py", line 485, in test_01_concurrent_requests 71: client.dump_log() 71: File "/home/jdanek/repos/qpid/qpid-dispatch/tests/http1_tests.py", line 207, in dump_log 71: self._logger.dump() 71: File "/home/jdanek/repos/qpid/qpid-dispatch/tests/system_test.py", line 1424, in dump 71: print(self) 71: TypeError: 'str' object is not callable {noformat} was: {code} def dump(self): print(self) sys.stdout.flush() @property def __str__(self): lines = [self.title] for ts, msg in self.logs: lines.append("%s %s" % (ts, msg)) res = str('\n'.join(lines)) return res {code} When dump() runs, Python's print() looks for a __str__ attribute on the argument, it finds it and tries to call it (as a function). But here it is a string, so this all fails with {noformat} 71: ====================================================================== 71: ERROR: test_01_concurrent_requests (system_tests_http1_adaptor.Http1AdaptorEdge2EdgeTest) 71: Test multiple concurrent clients sending streaming messages 71: ---------------------------------------------------------------------- 71: Traceback (most recent call last): 71: File "/home/jdanek/repos/qpid/qpid-dispatch/tests/http1_tests.py", line 485, in test_01_concurrent_requests 71: client.dump_log() 71: File "/home/jdanek/repos/qpid/qpid-dispatch/tests/http1_tests.py", line 207, in dump_log 71: self._logger.dump() 71: File "/home/jdanek/repos/qpid/qpid-dispatch/tests/system_test.py", line 1424, in dump 71: print(self) 71: TypeError: 'str' object is not callable {noformat} > In system_test.Logger, a __str__ must be a function, not a string @property > --------------------------------------------------------------------------- > > Key: DISPATCH-2063 > URL: https://issues.apache.org/jira/browse/DISPATCH-2063 > Project: Qpid Dispatch > Issue Type: Test > Components: Tests > Affects Versions: 1.15.0 > Reporter: Jiri Daněk > Assignee: Jiri Daněk > Priority: Major > Fix For: 1.16.0 > > > {code} > def dump(self): > print(self) > sys.stdout.flush() > @property > def __str__(self): > lines = [self.title] > for ts, msg in self.logs: > lines.append("%s %s" % (ts, msg)) > res = str('\n'.join(lines)) > return res > {code} > When dump() runs, Python's print() looks for a __str__ attribute on the > argument, it finds it and tries to call it (as a function). But here it is a > property which evaluates to a string, so this all fails with > {noformat} > 71: ====================================================================== > 71: ERROR: test_01_concurrent_requests > (system_tests_http1_adaptor.Http1AdaptorEdge2EdgeTest) > 71: Test multiple concurrent clients sending streaming messages > 71: ---------------------------------------------------------------------- > 71: Traceback (most recent call last): > 71: File "/home/jdanek/repos/qpid/qpid-dispatch/tests/http1_tests.py", line > 485, in test_01_concurrent_requests > 71: client.dump_log() > 71: File "/home/jdanek/repos/qpid/qpid-dispatch/tests/http1_tests.py", line > 207, in dump_log > 71: self._logger.dump() > 71: File "/home/jdanek/repos/qpid/qpid-dispatch/tests/system_test.py", line > 1424, in dump > 71: print(self) > 71: TypeError: 'str' object is not callable > {noformat} -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org For additional commands, e-mail: dev-h...@qpid.apache.org