[py-svn] r17201 - in py/dist/py/log: . testing
hpk at codespeak.net
hpk at codespeak.net
Sun Sep 4 13:21:53 CEST 2005
Author: hpk
Date: Sun Sep 4 13:21:53 2005
New Revision: 17201
Modified:
py/dist/py/log/producer.py
py/dist/py/log/testing/test_log.py
Log:
names with any '_' in them don't give new producers.
Modified: py/dist/py/log/producer.py
==============================================================================
--- py/dist/py/log/producer.py (original)
+++ py/dist/py/log/producer.py Sun Sep 4 13:21:53 2005
@@ -42,7 +42,7 @@
return "<py.log.Producer %s>" % ":".join(self.keywords)
def __getattr__(self, name):
- if name[0] == '_':
+ if '_' in name:
raise AttributeError, name
producer = self.__class__(self.keywords + (name,))
setattr(self, name, producer)
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 Sun Sep 4 13:21:53 2005
@@ -81,6 +81,11 @@
assert l
assert l[0].content() == "42"
+ def test_no_auto_producer(self):
+ p = py.log.Producer('x')
+ py.test.raises(AttributeError, "p._x")
+ py.test.raises(AttributeError, "p.x_y")
+
def test_setconsumer_with_producer(self):
l = []
p = py.log.Producer("hello")
More information about the pytest-commit
mailing list