-
Notifications
You must be signed in to change notification settings - Fork 6
Make Counter thread-safe. #9
base: master
Are you sure you want to change the base?
Conversation
from unittest2 import TestCase | ||
|
||
from yunomi.core.counter import Counter | ||
|
||
|
||
class CounterTests(TestCase): | ||
_counter = Counter() | ||
def setUp(self): | ||
_RLock_patcher = mock.patch('yunomi.core.counter.RLock') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any particular reason why this call does not use spec_set
? That should be IMHO always used when using mock – or at least spec
. cf. http://blog.futurefoundries.com/2013/02/mock-assurances.html
Also why the _-prefix for a local variable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was under the apparently mistaken impression that mock.patch always spec'd the object it was patching.
The code LGTM—my OCD aside. |
…re is no opportunity for re-entrancy.
LGTM |
I want to write some solid benchmarks but I think this would be better with: https://github.com/dreid/atomiclong |
@dreid Are you still maintaining this lib? All these PRs still open from 2013 |
No description provided.