Load overrides.zcml in plone.app.testing

Today I was working on a project where we use overrides.zcml to easily override some default Plone behavior. All was working fine (in the browser, that is) until I started writing tests for our custom behavior. First thing I noticed was that the overrides.zcml was not loaded in our test layer. "Doh, I need to load it manually with the…

Robot on Travis – uploading results to S3

This is a walkthrough of how one could upload to Amazon S3 screenshots and other output files produced by Robot framework ran in a Travis CI build. The reason why we want to do this is to be able to inspect what Robot sees and have more information when a test fails. It's written with some things specific to Plone development,…

Testing log output

ATTRIBUTION: This post was inspired by Domen's Mocking logging module for unittests post back from 2009. Most of the code below is from him, with some added Plone specific bits and pieces. I was recently debugging an installation of our niteoweb.click2sell and had the need for more verbose error handling. After adding support for it in the code I wondered…

Testing memoized methods

For a recent Plone project we needed to write unit tests for methods that were using plone.memoize for caching return values. With a standard Plone's PloneTestCase I got the following error: Error in test test_main_image (niteoweb.elcond.tests.test_stol.TestContent) Traceback (most recent call last): File "/Users/zupo/work/python/parts/opt/lib/python2.6/unittest.py", line 279, in run testMethod() File "/Users/zupo/work/niteoweb.elcond/src/niteoweb/elcond/tests/test_stol.py", line 75, in test_main_image image = self.portal.stol.main_image() File "/Users/zupo/work/niteoweb.elcond/src/niteoweb/elcond/content/stol.py", line…

Testing session in Plone 3.3

Yesterday, while I was working on LifeInLjubljana.si, I had to test if some data was correctly written to Plone's session. I couldn't use the standard ptc.FunctionalTestCase test case as it does not have a session and I would get errors like this: (Pdb) self.context.session_data_manager *** AttributeError: session_data_manager (Pdb) self.context.REQUEST.SESSION *** AttributeError: SESSION Following a tip on the Plone-Users mailing list…