Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Mock Zope PythonScript and CMF FSPythonScript for unit testing of said scripts.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 isotoma
Octocat-spinner-32 HISTORY.rst
Octocat-spinner-32 README
Octocat-spinner-32 README.rst
Octocat-spinner-32 setup.py
README.rst

isotoma.zope.testpythonscript

Provides simple classes to be used for unit testing PythonScript and FSPythonScripts from Zope / Plone.

Uses the bare minimum of setup code and does not require Zope or Plone to run.

Example usage

>>> from isotoma.zope.testpythonscript import PythonScript
>>> my_script = """## Script to output stuff given to it
... ##bind container=container
... ##bind context=context
... ##bind namespace=namespace
... ##bind script=script
... ##bind state=state
... ##bind traverse_subpath=traverse_subpath
... ##parameters=name=None
... ##title=
... ##
... return 'Hello world! Hello %s!' % name
... """
>>> py_script = PythonScript(my_script, 'my_script')
>>> py_script(name='Foo')
'Hello world! Hello Foo'
>>>

See the documentation of isotoma.zope.testpythonscript.script for full details of the class and of FSPythonScript.

See isotoma.zope.testpythonscript.tests.test_script for more examples.

Something went wrong with that request. Please try again.