[py-svn] r13609 - in py/dist/py/log: . testing

cfbolz at codespeak.net cfbolz at codespeak.net
Mon Jun 20 11:32:10 CEST 2005


Author: cfbolz
Date: Mon Jun 20 11:32:06 2005
New Revision: 13609

Modified:
   py/dist/py/log/producer.py
   py/dist/py/log/testing/test_log.py
Log:
fixed producer's __getattr__ + test


Modified: py/dist/py/log/producer.py
==============================================================================
--- py/dist/py/log/producer.py	(original)
+++ py/dist/py/log/producer.py	Mon Jun 20 11:32:06 2005
@@ -45,7 +45,7 @@
         if name[0] == '_': 
             raise AttributeError, name
         producer = self.__class__(self.keywords + (name,))
-        self.name = producer
+        setattr(self, name, producer)
         return producer 
     
     def __call__(self, *args):

Modified: py/dist/py/log/testing/test_log.py
==============================================================================
--- py/dist/py/log/testing/test_log.py	(original)
+++ py/dist/py/log/testing/test_log.py	Mon Jun 20 11:32:06 2005
@@ -35,6 +35,11 @@
         assert len(l[0].keywords) == 1
         assert 'x1' == l[0].keywords[0]
 
+    def test_producer_caching(self):
+        p = py.log.Producer('x1')
+        x2 = p.x2
+        assert x2 is p.x2
+
 class TestLogConsumer: 
     def setup_method(self, meth): 
         self.state = py.log._getstate() 



More information about the pytest-commit mailing list