Adding Console Scripts to a Plone Buildout

In a straight setupttools-based application, adding one or more console scripts is straightforward: you just declare them in the setup.py, and set setuptools build them for you. However, when using zc.buildout for Plone 3.0.x or 3.1.x, you have to arrange to get the non-eggified Zope2 products on the path, which is not easy. This recipe works for me.

Read more…

More on repoze.urispace

I blogged yesterday about the fact that I had docs online for the repoze.urispace package, but didn't do much to motivate readers' interest: repoze.urispace should be interesting if you have an application which needs policies which vary based on "where" in the site the request is addressed. Examples might include: fine- grained security, theme selection, caching policies, etc.

Read more…

Avoiding Temptation: Notes on using 'unittest' effectively

Avoiding Temptation: Notes on using 'unittest' effectively

Goals

The goals of the kind of testing outlined here are simplicity, loose or no coupling, and speed:

  • Tests should be as simple as possible, while exercising the application- under-test (AUT) completely.
  • Tests should run as quickly as possible, to encourage running them frequently.
  • Tests should avoid coupling with other tests, or with parts of the AUT which they are not responsible for testing.

Developers write such tests to verify that the AUT is abiding by the contracts the developer specifies. While an instance this type of test case may be illustrative of the contract it tests, such test cases do not take the place of either API documentation or of narrative / "theory of operations" documentation. Still less are they intended for end-user documentation.

Read more…