diff options
author | Marc Bonnici <marc.bonnici@arm.com> | 2018-05-22 16:17:10 +0100 |
---|---|---|
committer | setrofim <setrofim@gmail.com> | 2018-05-22 17:18:40 +0100 |
commit | 3efff81a5c74586dba7420ad143db2cc6bb693a5 (patch) | |
tree | 474b4a7d3ae6314239ca6181b4fb898eb9ad9ab5 /tests | |
parent | bea36cc39820be891187d54665346d72a489bd1e (diff) |
utils/exec_control: Fix issue with `once_per_instance` decorator
Previously the `once_per_instance` used the output of `__repr__` to
identify the class of where the decorated method was called from. For
classes that override this method to produce the same output for
different instances of the same class this caused different instances to
be mistakenly treated as one. Now use the hash of the containing class
instead of the string representation and update the tests to catch this
error.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_exec_control.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/test_exec_control.py b/tests/test_exec_control.py index 73484fad..7c619f6e 100644 --- a/tests/test_exec_control.py +++ b/tests/test_exec_control.py @@ -46,6 +46,9 @@ class TestClass(object): def initilize_once_per_instance(self): self.count += 1 + def __repr__(self): + return '{}: Called={}'.format(self.__class__.__name__, self.called) + class SubClass(TestClass): |