From 3687456e788be9673eb0477242b63bbe5e75d235 Mon Sep 17 00:00:00 2001 From: Daniel Greenfeld Date: Tue, 20 May 2014 09:00:52 -0700 Subject: [PATCH] documentating release and making small documentation tweaks --- .travis.yml | 1 + cached_property.py | 5 ++--- setup.py | 3 ++- tests/test_cached_property.py | 11 +++++------ 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index f96c7ce..1bc0445 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ language: python python: + - "3.4" - "3.3" - "2.7" - "2.6" diff --git a/cached_property.py b/cached_property.py index 46bcef7..c07f508 100644 --- a/cached_property.py +++ b/cached_property.py @@ -2,10 +2,9 @@ __author__ = 'Daniel Greenfeld' __email__ = 'pydanny@gmail.com' -__version__ = '0.1.4' +__version__ = '0.1.5' __license__ = 'BSD' -import time import threading @@ -45,4 +44,4 @@ class threaded_cached_property(cached_property): return obj.__dict__[prop_name] # If not, do the calculation and release the lock. - return super(threaded_cached_property, self).__get__(obj, cls) \ No newline at end of file + return super(threaded_cached_property, self).__get__(obj, cls) diff --git a/setup.py b/setup.py index a6c71d5..c162703 100755 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ try: except ImportError: from distutils.core import setup -__version__ = '0.1.4' +__version__ = '0.1.5' readme = open('README.rst').read() history = open('HISTORY.rst').read().replace('.. :changelog:', '') @@ -44,5 +44,6 @@ setup( 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.3', + 'Programming Language :: Python :: 3.4', ], ) diff --git a/tests/test_cached_property.py b/tests/test_cached_property.py index 9835738..e836386 100755 --- a/tests/test_cached_property.py +++ b/tests/test_cached_property.py @@ -87,7 +87,9 @@ class TestCachedProperty(unittest.TestCase): class TestThreadingIssues(unittest.TestCase): def test_threads(self): - """ How well does this implementation work with threads?""" + """ How well does the standard cached_property implementation work with threads? + Short answer: It doesn't! Use threaded_cached_property instead! + """ class Check(object): @@ -114,12 +116,9 @@ class TestThreadingIssues(unittest.TestCase): for thread in threads: thread.join() - # TODO: This assertion should be working. - # See https://github.com/pydanny/cached-property/issues/6 - # self.assertEqual(c.add_cached, 1) + # Threads means that caching is bypassed. + self.assertNotEqual(c.add_cached, 1) - # TODO: This assertion should be failing. - # See https://github.com/pydanny/cached-property/issues/6 # This assertion hinges on the fact the system executing the test can # spawn and start running num_threads threads within the sleep period # (defined in the Check class as 1 second). If num_threads were to be -- 2.30.2