Skip to content
This repository has been archived by the owner on May 31, 2019. It is now read-only.

Make Counter thread-safe. #9

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Make Counter thread-safe. #9

wants to merge 4 commits into from

Conversation

dreid
Copy link
Owner

@dreid dreid commented Jun 14, 2013

No description provided.

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')
Copy link
Contributor

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?

Copy link
Owner Author

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.

@hynek
Copy link
Contributor

hynek commented Jun 14, 2013

The code LGTM—my OCD aside.

@hynek
Copy link
Contributor

hynek commented Jul 27, 2013

LGTM

@dreid
Copy link
Owner Author

dreid commented Sep 1, 2013

I want to write some solid benchmarks but I think this would be better with: https://github.com/dreid/atomiclong

@sontek
Copy link

sontek commented Mar 27, 2015

@dreid Are you still maintaining this lib? All these PRs still open from 2013

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants