Re: [Zope-dev] Re: Logging of ConflictError
On Sat, Dec 03, 2005 at 07:51:28PM +, Chris Withers wrote: | Sidnei da Silva wrote: | > | >On Dec 2, 2005, at 3:51 PM, Chris Withers wrote: | > | >>Sidnei da Silva wrote: | >> | >>>I was looking at the same issue yesterday, and it's really a trivial | >>>change. Need to add a 'multisection' to zopeschema.xml that allows | >>>multiple 'logger' type entries. Then you can just do something like: | >> | >> | >>Yes, that bit is simple. But in 2.8.something and above, the eventlog | >>is plugged in as a root logger, meaning you can't get anything logged | >>that doesn't go to it. Who made this change and why? | > | >Yes you can. Just set 'propagate' to a non-true value. | | Can you be a bit more descriptive? OS thisa zope.conf option? an option | to the logger call? etc? Heard of grep? *wink* >From ZConfig/components/logger/logger.xml Indicates whether events that reach this logger should be propogated toward the root of the logger hierarchy. If true (the default), events will be passed to the logger's parent after being handled. If false, events will be handled and the parent will not be informed. There is not a way to control propogation by the severity of the event. -- Sidnei da Silva Enfold Systems, LLC. http://enfoldsystems.com ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Re: Logging of ConflictError
Sidnei da Silva wrote: On Dec 2, 2005, at 3:51 PM, Chris Withers wrote: Sidnei da Silva wrote: I was looking at the same issue yesterday, and it's really a trivial change. Need to add a 'multisection' to zopeschema.xml that allows multiple 'logger' type entries. Then you can just do something like: Yes, that bit is simple. But in 2.8.something and above, the eventlog is plugged in as a root logger, meaning you can't get anything logged that doesn't go to it. Who made this change and why? Yes you can. Just set 'propagate' to a non-true value. Can you be a bit more descriptive? OS thisa zope.conf option? an option to the logger call? etc? Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] AcceleratedHTTPCache and virtual hosting (collector 1447)
On Dec 3, 2005, at 11:08 AM, Jens Vagelpohl wrote: On 3 Dec 2005, at 15:57, Paul Winkler wrote: One thought that occurs to me is to replace httplib.HTTPConnection with a mock object of some sort that allows easy verification of its input. So we assume that httplib works, as a proper unit test should I think. How to do this? One idea is to monkeypatch httplib during the course of the test case, and replace and then when the test finishes, restore the old httplib.HTTPConnection. But this idea smells pretty bad to me. Another thought: Maybe before doing anything else, I should make the client class used by AcceleratedHTTPCache configurable, so I can more easily get a mock in there. Something like: I like the secondary route, but I'm not sure the production code should contain "testing only" turds. :) FWIW, I put "testing only" turds all the time in production code. It's pretty sane as long as you put a comment in the code that says "this dance performed to service unit tests" or somesuch. And it makes life much easier than needing to dummy up *everything*. - C ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: SVN: Zope/branches/Zope-2_8-branch/test.py Implemented a --nowarnings flag for test.py.
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Stefan H. Holek wrote: > Log message for revision 40519: > Implemented a --nowarnings flag for test.py. > Makes running CMF and Plone tests a lot less annoying. Note that the CMF tests run clean at this point. Suppressing the warning output is not likely to improve the quality of a codebase. Tres. - -- === Tres Seaver +1 202-558-7113 [EMAIL PROTECTED] Palladion Software "Excellence by Design"http://palladion.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.1 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFDkche+gerLs4ltQ4RAuj/AKDCRrBAqlMHdv8hBYeccKXPwREvngCgzsxi d543wvSFQvp63eVcmIeETWU= =yWgx -END PGP SIGNATURE- ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: AcceleratedHTTPCache and virtual hosting (collector 1447)
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Paul Winkler wrote: > Hi folks, need some advice here. > > http://www.zope.org/Collectors/Zope/1447 > ("AcceleratedHTTPCacheManager doesn't PURGE correctly for virtual > hosts") has been assigned to me like forever, and I've determined > to not let another year go by with this one unfixed ;-) > > I'd like to apply the patch and commit, once I'm sure it works > correctly, but - drumroll - AcceleratedHTTPCacheManager has no test > suite at all. Which means, as frequently happens with Zope 2, I have to > go through the pain of setting up a test suite for the current behavior > before I go changing anything. > > The fun thing about this is that AcceleratedHTTPCache uses httplib to > send purge notifications. I don't fancy launching a dummy server of some > sort. So, I'm asking for advice: How in general does one go about > setting up a unit test for network client code? > > One thought that occurs to me is to replace httplib.HTTPConnection with > a mock object of some sort that allows easy verification of its input. > So we assume that httplib works, as a proper unit test should I think. > How to do this? One idea is to monkeypatch httplib during the course of > the test case, and replace and then when the test finishes, restore the > old httplib.HTTPConnection. But this idea smells pretty bad to me. > > Another thought: Maybe before doing anything else, I should make the > client class used by AcceleratedHTTPCache configurable, so I can more > easily get a mock in there. Something like: > > class AcceleratedHTTPCache (Cache): > client_class = httplib.HTTPConnection > ... > def ZCache_invalidate(self, ob): > ... > h = self.client_class(host) > ... > > Then I can just do something like this during afterSetUp(): > > cache = AcceleratedHTTPCache() > cache.client_class = MockHTTPConnection > > > Any better ideas? You could modify the testing code do an adapter lookup for a component used to do the HTTP client stuff, and then arrange to register your dummy object in a test. I imagine that this would be useful for more than just testing; for instance, if I want to purge a whole tier of Squids, right now the only way to do that is to write a proxy-proxy (one version I wrote once was called PageAssassin) which distributes the PURGE request to them. An adapter-based scheme would allow me to replace the stock version with one which distributed the PURGE directly. Tres. - -- === Tres Seaver +1 202-558-7113 [EMAIL PROTECTED] Palladion Software "Excellence by Design"http://palladion.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.1 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFDkcf8+gerLs4ltQ4RAp1yAKCuIZDPKujDQR3qDxUn7Ik0y0u2tQCfXiWC iDSM7oV4ABVktTwCMzXfN8c= =MpSy -END PGP SIGNATURE- ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] AcceleratedHTTPCache and virtual hosting (collector 1447)
On 3 Dec 2005, at 15:57, Paul Winkler wrote: One thought that occurs to me is to replace httplib.HTTPConnection with a mock object of some sort that allows easy verification of its input. So we assume that httplib works, as a proper unit test should I think. How to do this? One idea is to monkeypatch httplib during the course of the test case, and replace and then when the test finishes, restore the old httplib.HTTPConnection. But this idea smells pretty bad to me. Another thought: Maybe before doing anything else, I should make the client class used by AcceleratedHTTPCache configurable, so I can more easily get a mock in there. Something like: I like the secondary route, but I'm not sure the production code should contain "testing only" turds. :) I have done the first route on many occasions, mostly with the LDAPUserFolder where I actually replace a class in the python-ldap module with one that fakes out a LDAP connection object so I can operate on it: # Do some namespace manipulation to make use of FakeLDAP from Products.LDAPUserFolder.tests import FakeLDAP sys.modules['ldap'] = FakeLDAP This could also be done in setUp/tearDown, which I should really do because this code does not clean up after itself. If you happened to run other code after running the test and with the same running interpreter that just happens to use the python-ldap module you'd be in bad shape ;) jens ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] AcceleratedHTTPCache and virtual hosting (collector 1447)
Hi folks, need some advice here. http://www.zope.org/Collectors/Zope/1447 ("AcceleratedHTTPCacheManager doesn't PURGE correctly for virtual hosts") has been assigned to me like forever, and I've determined to not let another year go by with this one unfixed ;-) I'd like to apply the patch and commit, once I'm sure it works correctly, but - drumroll - AcceleratedHTTPCacheManager has no test suite at all. Which means, as frequently happens with Zope 2, I have to go through the pain of setting up a test suite for the current behavior before I go changing anything. The fun thing about this is that AcceleratedHTTPCache uses httplib to send purge notifications. I don't fancy launching a dummy server of some sort. So, I'm asking for advice: How in general does one go about setting up a unit test for network client code? One thought that occurs to me is to replace httplib.HTTPConnection with a mock object of some sort that allows easy verification of its input. So we assume that httplib works, as a proper unit test should I think. How to do this? One idea is to monkeypatch httplib during the course of the test case, and replace and then when the test finishes, restore the old httplib.HTTPConnection. But this idea smells pretty bad to me. Another thought: Maybe before doing anything else, I should make the client class used by AcceleratedHTTPCache configurable, so I can more easily get a mock in there. Something like: class AcceleratedHTTPCache (Cache): client_class = httplib.HTTPConnection ... def ZCache_invalidate(self, ob): ... h = self.client_class(host) ... Then I can just do something like this during afterSetUp(): cache = AcceleratedHTTPCache() cache.client_class = MockHTTPConnection Any better ideas? testing-network-stuff-hurts-my-head-ly-yrs, -- Paul Winkler http://www.slinkp.com ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Zope tests: 8 OK
Summary of messages to the zope-tests list. Period Fri Dec 2 12:01:01 2005 UTC to Sat Dec 3 12:01:01 2005 UTC. There were 8 messages: 8 from Zope Unit Tests. Tests passed OK --- Subject: OK : Zope-2_6-branch Python-2.1.3 : Linux From: Zope Unit Tests Date: Fri Dec 2 22:16:08 EST 2005 URL: http://mail.zope.org/pipermail/zope-tests/2005-December/003698.html Subject: OK : Zope-2_6-branch Python-2.3.5 : Linux From: Zope Unit Tests Date: Fri Dec 2 22:17:38 EST 2005 URL: http://mail.zope.org/pipermail/zope-tests/2005-December/003699.html Subject: OK : Zope-2_7-branch Python-2.3.5 : Linux From: Zope Unit Tests Date: Fri Dec 2 22:19:08 EST 2005 URL: http://mail.zope.org/pipermail/zope-tests/2005-December/003700.html Subject: OK : Zope-2_7-branch Python-2.4.2 : Linux From: Zope Unit Tests Date: Fri Dec 2 22:20:38 EST 2005 URL: http://mail.zope.org/pipermail/zope-tests/2005-December/003701.html Subject: OK : Zope-2_8-branch Python-2.3.5 : Linux From: Zope Unit Tests Date: Fri Dec 2 22:22:08 EST 2005 URL: http://mail.zope.org/pipermail/zope-tests/2005-December/003702.html Subject: OK : Zope-2_8-branch Python-2.4.2 : Linux From: Zope Unit Tests Date: Fri Dec 2 22:23:38 EST 2005 URL: http://mail.zope.org/pipermail/zope-tests/2005-December/003703.html Subject: OK : Zope-2_9-branch Python-2.4.2 : Linux From: Zope Unit Tests Date: Fri Dec 2 22:25:08 EST 2005 URL: http://mail.zope.org/pipermail/zope-tests/2005-December/003704.html Subject: OK : Zope-trunk Python-2.4.2 : Linux From: Zope Unit Tests Date: Fri Dec 2 22:26:39 EST 2005 URL: http://mail.zope.org/pipermail/zope-tests/2005-December/003705.html ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )