This release is a pre-release and may not be stable for production use.
Introduction
plone.testlayers is supposed to make setting up test layers for Plone integration tests quick and painless. It’s main function, makeTestLayer will conveniently generate a test layer, which will load your packages ZCML and install them, apply a GenericSetup profile and help you set up sample content for speedier testing.
Usage
To make use of plone.testlayers you’d typically create a base test case for your package, somewhat like:
from Products.PloneTestCase import PloneTestCase as ptc
from plone.testlayers import makeTestLayer
def create(portal):
""" create sample content for test runs """
portal.invokeFactory('File', 'foo', title='foo', file='foo bar')
def destroy(portal):
""" clean up sample content for test runs """
portal.manage_delObjects(ids='foo')
ptc.setupPloneSite()
FooLayer = makeTestLayer(packages=('collective.foo', 'collective.bar'),
profile='collective.foo:default', create=create, destroy=destroy)
class FooTestCase(ptc.PloneTestCase):
""" base class for integration tests """
layer = FooLayer
With that in place you can now set up your individual test cases like:
from unittest import defaultTestLoader
from collective.foo.tests.base import FooTestCase
class FooTests(FooTestCase):
def testFoo(self):
# the 'foo' object set up in the layer should already exist
self.failUnless(self.portal['foo'])
def test_suite():
return defaultTestLoader.loadTestsFromName(__name__)
Changelog
1.0a3 - Released April 24, 2009
Add support for generating multiple test layers. [witsch]
1.0a2 - Released April 23, 2009
Fix source distribution by using a MANIFEST.in. [witsch]
1.0a1 - Released April 23, 2009
Initial release. [witsch]
Release files for plone.testlayers 1.0a3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| plone.testlayers-1.0a3.zip | 17.1 kB | Details |
Release files / plone.testlayers-1.0a3.zip
| Download URL | plone.testlayers-1.0a3.zip |
|---|---|
| Size | 17.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
27e672085328cc658d7a283508349f9014d70fb2860394a67cf8583fc5e5da12
|
|
BLAKE2b-256 checksum How to use checksums |
d7cd33bc40fc5e6b8af14ad3814f6e34b345c3ec04860d3defcb07ba83e53e1d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |