Commit 2ca1aff5 authored by Stefan H. Holek's avatar Stefan H. Holek

Added "Copyright (c) 2005 Zope Corporation and Contributors." header to

all *.py files. Converted lead-in comments to module docstrings.
parent 70b92f39
##############################################################################
#
# Abstract base test case for working with CMF-style portals
# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
#
# This base class maintains a fixture consisting of:
#
# - a portal object (self.portal)
# - a user folder inside the portal
# - a default user with role 'Member' inside the user folder
# - the default user's memberarea (self.folder)
# - the default user is logged in
#
# The twist is that the portal object itself is *not* created
# by the PortalTestCase class! Subclasses must make sure
# getPortal() returns a usable portal object to the setup code.
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Abstract base test case for working with CMF-style portals
This class maintains a fixture consisting of:
- a portal object (self.portal)
- a user folder inside the portal
- a default user with role 'Member' inside the user folder
- the default user's memberarea (self.folder)
- the default user is logged in
The twist is that the portal object itself is *not* created
by the PortalTestCase class! Subclasses must make sure
getPortal() returns a usable portal object to the setup code.
# $Id: PortalTestCase.py,v 1.38 2005/02/09 12:42:40 shh42 Exp $
$Id: PortalTestCase.py,v 1.38 2005/02/09 12:42:40 shh42 Exp $
"""
import base
import interfaces
......
##############################################################################
#
# Lightweight Zope startup
# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
#
# Fast Zope startup is achieved by not installing (m)any
# products. If your tests require a product you must
# install it yourself using installProduct().
#
# Typically used as in
#
# import ZopeLite as Zope2
# Zope2.installProduct('SomeProduct')
# app = Zope2.app()
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Lightweight Zope startup
Fast Zope startup is achieved by not installing (m)any
products. If your tests require a product you must
install it yourself using installProduct().
Typically used as in
import ZopeLite as Zope2
Zope2.installProduct('SomeProduct')
app = Zope2.app()
# $Id: ZopeLite.py,v 1.24 2004/08/18 09:28:54 shh42 Exp $
$Id: ZopeLite.py,v 1.24 2004/08/18 09:28:54 shh42 Exp $
"""
import os, sys, time
......
##############################################################################
#
# Default test case & fixture for Zope testing
# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
#
# The fixture consists of:
#
# - a folder (self.folder)
# - a user folder inside that folder
# - a default user inside the user folder
#
# The default user is logged in and has the 'Access contents information'
# and 'View' permissions given to his role.
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Default test case & fixture for Zope testing
The fixture consists of:
- a folder (self.folder)
- a user folder inside that folder
- a default user inside the user folder
The default user is logged in and has the 'Access contents information'
and 'View' permissions given to his role.
# $Id: ZopeTestCase.py,v 1.29 2005/02/09 12:42:40 shh42 Exp $
$Id: ZopeTestCase.py,v 1.29 2005/02/09 12:42:40 shh42 Exp $
"""
import base
import functional
......
##############################################################################
#
# Names exported by the ZopeTestCase package
# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Names exported by the ZopeTestCase package
# $Id: __init__.py,v 1.25 2005/02/22 14:59:16 shh42 Exp $
$Id: __init__.py,v 1.25 2005/02/22 14:59:16 shh42 Exp $
"""
import ZopeLite as Zope2
import utils
......
##############################################################################
#
# Test case for Zope testing
# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""TestCase for Zope testing
# $Id: base.py,v 1.1 2004/08/19 13:59:41 shh42 Exp $
$Id: base.py,v 1.1 2004/08/19 13:59:41 shh42 Exp $
"""
import ZopeLite as Zope2
......
##############################################################################
#
# ZopeTestCase
# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
#
# COPY THIS FILE TO YOUR 'tests' DIRECTORY.
#
# This version of framework.py will use the SOFTWARE_HOME
# environment variable to locate Zope and the Testing package.
#
# If the tests are run in an INSTANCE_HOME installation of Zope,
# Products.__path__ and sys.path with be adjusted to include the
# instance's Products and lib/python directories respectively.
#
# If you explicitly set INSTANCE_HOME prior to running the tests,
# auto-detection is disabled and the specified path will be used
# instead.
#
# If the 'tests' directory contains a custom_zodb.py file, INSTANCE_HOME
# will be adjusted to use it.
#
# If you set the ZEO_INSTANCE_HOME environment variable a ZEO setup
# is assumed, and you can attach to a running ZEO server (via the
# instance's custom_zodb.py).
#
##############################################################################
#
# The following code should be at the top of every test module:
#
# import os, sys
# if __name__ == '__main__':
# execfile(os.path.join(sys.path[0], 'framework.py'))
#
# ...and the following at the bottom:
#
# if __name__ == '__main__':
# framework()
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""ZopeTestCase framework
COPY THIS FILE TO YOUR 'tests' DIRECTORY.
This version of framework.py will use the SOFTWARE_HOME
environment variable to locate Zope and the Testing package.
If the tests are run in an INSTANCE_HOME installation of Zope,
Products.__path__ and sys.path with be adjusted to include the
instance's Products and lib/python directories respectively.
If you explicitly set INSTANCE_HOME prior to running the tests,
auto-detection is disabled and the specified path will be used
instead.
If the 'tests' directory contains a custom_zodb.py file, INSTANCE_HOME
will be adjusted to use it.
If you set the ZEO_INSTANCE_HOME environment variable a ZEO setup
is assumed, and you can attach to a running ZEO server (via the
instance's custom_zodb.py).
The following code should be at the top of every test module:
import os, sys
if __name__ == '__main__':
execfile(os.path.join(sys.path[0], 'framework.py'))
...and the following at the bottom:
if __name__ == '__main__':
framework()
$Id:$
"""
__version__ = '0.2.3'
__version__ = '0.2.4'
# Save start state
#
......
##############################################################################
#
# Support for functional unit testing in ZTC
# After Marius Gedminas' functional.py module for Zope3.
# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Support for functional unit testing in ZTC
After Marius Gedminas' functional.py module for Zope 3.
# $Id: functional.py,v 1.3 2004/09/12 16:49:59 shh42 Exp $
$Id: functional.py,v 1.3 2004/09/12 16:49:59 shh42 Exp $
"""
import sys, re, base64
import transaction
......
##############################################################################
#
# ZopeTestCase interfaces
# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""ZopeTestCase interfaces
# $Id: interfaces.py,v 1.5 2005/02/07 21:59:35 shh42 Exp $
$Id: interfaces.py,v 1.5 2005/02/07 21:59:35 shh42 Exp $
"""
try:
from Interface import Interface
......
##############################################################################
#
# Profiling support for ZTC
# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Profiling support for ZTC
# $Id: profiler.py,v 1.3 2005/01/01 14:02:44 shh42 Exp $
$Id: profiler.py,v 1.3 2005/01/01 14:02:44 shh42 Exp $
"""
import os, sys
import interfaces
......
##############################################################################
#
# Runs all tests in the current directory [and below]
# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
#
# Execute like:
# python runalltests.py [-R]
#
# Alternatively use the testrunner:
# python /path/to/Zope/bin/testrunner.py -qa
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Runs all tests in the current directory [and below]
Execute like:
python runalltests.py [-R]
$Id:$
"""
__version__ = '0.2.1'
import os, sys
if __name__ == '__main__':
......
##############################################################################
#
# Support for ZODB sandboxes in ZTC
# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Support for ZODB sandboxes in ZTC
# $Id: sandbox.py,v 1.2 2004/08/19 15:31:26 shh42 Exp $
$Id: sandbox.py,v 1.2 2004/08/19 15:31:26 shh42 Exp $
"""
import ZopeLite as Zope2
import transaction
......
##############################################################################
#
# Tests the base.TestCase class
# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
#
# NOTE: This is *not* an example TestCase. Do not
# use this file as a blueprint for your own tests!
#
# See testPythonScript.py and testShoppingCart.py for
# example test cases. See testSkeleton.py for a quick
# way of getting started.
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Tests the base.TestCase class
NOTE: This is *not* an example TestCase. Do not
use this file as a blueprint for your own tests!
See testPythonScript.py and testShoppingCart.py for
example test cases. See testSkeleton.py for a quick
way of getting started.
# $Id: testBaseTestCase.py,v 1.7 2005/02/09 12:42:40 shh42 Exp $
$Id: testBaseTestCase.py,v 1.7 2005/02/09 12:42:40 shh42 Exp $
"""
import os, sys
if __name__ == '__main__':
......
##############################################################################
#
# Example functional ZopeTestCase
# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Example functional ZopeTestCase
# $Id: testFunctional.py,v 1.16 2005/02/12 13:13:04 shh42 Exp $
$Id: testFunctional.py,v 1.16 2005/02/12 13:13:04 shh42 Exp $
"""
import os, sys
if __name__ == '__main__':
......
##############################################################################
#
# Interface tests
# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Interface tests
# $Id: testInterfaces.py,v 1.3 2005/01/01 20:38:16 shh42 Exp $
$Id: testInterfaces.py,v 1.3 2005/01/01 20:38:16 shh42 Exp $
"""
import os, sys
if __name__ == '__main__':
......
##############################################################################
#
# Tests the PortalTestCase
# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
#
# NOTE: This is *not* an example TestCase. Do not
# use this file as a blueprint for your own tests!
#
# See testPythonScript.py and testShoppingCart.py for
# example test cases. See testSkeleton.py for a quick
# way of getting started.
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Tests the PortalTestCase
NOTE: This is *not* an example TestCase. Do not
use this file as a blueprint for your own tests!
See testPythonScript.py and testShoppingCart.py for
example test cases. See testSkeleton.py for a quick
way of getting started.
# $Id: testPortalTestCase.py,v 1.30 2005/01/30 14:22:48 shh42 Exp $
$Id: testPortalTestCase.py,v 1.30 2005/01/30 14:22:48 shh42 Exp $
"""
import os, sys
if __name__ == '__main__':
......
##############################################################################
#
# Example ZopeTestCase testing a PythonScript object in the default fixture.
# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
#
# Note that you are encouraged to call any of the following methods
# from your own tests to modify the test user's security credentials:
#
# - setRoles()
# - setPermissions()
# - login()
# - logout()
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Example ZopeTestCase testing a PythonScript object in the default fixture
Note that you are encouraged to call any of the following methods
from your own tests to modify the test user's security credentials:
- setRoles()
- setPermissions()
- login()
- logout()
# $Id: testPythonScript.py,v 1.9 2004/04/09 12:38:37 shh42 Exp $
$Id: testPythonScript.py,v 1.9 2004/04/09 12:38:37 shh42 Exp $
"""
import os, sys
if __name__ == '__main__':
......
##############################################################################
#
# Example ZopeTestCase testing the ShoppingCart example application.
# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
#
# Note the use of sessions and how the SESSION object is added to
# the REQUEST in afterSetUp().
#
# You can use zLOG.LOG() if you set up the event log variables first.
# Handy for debugging and tracing your tests.
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Example ZopeTestCase testing the ShoppingCart example application.
Note the use of sessions and how the SESSION object is added to
the REQUEST in afterSetUp().
You can use zLOG.LOG() if you set up the event log variables first.
Handy for debugging and tracing your tests.
# $Id: testShoppingCart.py,v 1.11 2005/02/23 17:14:56 shh42 Exp $
$Id: testShoppingCart.py,v 1.11 2005/02/23 17:14:56 shh42 Exp $
"""
import os, sys
if __name__ == '__main__':
......
##############################################################################
#
# Skeleton ZopeTestCase
# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Skeleton ZopeTestCase
$Id:$
"""
import os, sys
if __name__ == '__main__':
......
##############################################################################
#
# Example ZopeTestCase testing web access to a freshly started ZServer.
# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
#
# Note that we need to set up the error_log before starting the ZServer.
#
# Note further that the test thread needs to explicitly commit its
# transactions, so the ZServer threads can see modifications made to
# the ZODB.
#
# IF YOU THINK YOU NEED THE WEBSERVER STARTED YOU ARE PROBABLY WRONG!
# This is only required in very special cases, like when testing
# ZopeXMLMethods where XSLT processing is done by external tools that
# need to URL-call back into the Zope server.
#
# If you want to write functional unit tests, see the testFunctional.py
# example instead.
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Example ZopeTestCase testing web access to a freshly started ZServer
Note that we need to set up the error_log before starting the ZServer.
Note further that the test thread needs to explicitly commit its
transactions, so the ZServer threads can see modifications made to
the ZODB.
IF YOU THINK YOU NEED THE WEBSERVER STARTED YOU ARE PROBABLY WRONG!
This is only required in very special cases, like when testing
ZopeXMLMethods where XSLT processing is done by external tools that
need to URL-call back into the Zope server.
If you want to write functional unit tests, see the testFunctional.py
example instead.
# $Id: testWebserver.py,v 1.16 2005/02/12 13:11:10 shh42 Exp $
$Id: testWebserver.py,v 1.16 2005/02/12 13:11:10 shh42 Exp $
"""
import os, sys
if __name__ == '__main__':
......
##############################################################################
#
# Tests ZODB behavior in ZopeTestCase
# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
#
# Demonstrates that cut/copy/paste/clone/rename and import/export
# work in ZopeTestCase if a subtransaction is commited before performing
# the respective operations.
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Tests ZODB behavior in ZopeTestCase
# $Id: testZODBCompat.py,v 1.17 2004/04/09 12:38:37 shh42 Exp $
Demonstrates that cut/copy/paste/clone/rename and import/export
work in ZopeTestCase if a subtransaction is commited before performing
the respective operations.
$Id: testZODBCompat.py,v 1.17 2004/04/09 12:38:37 shh42 Exp $
"""
import os, sys
if __name__ == '__main__':
......
##############################################################################
#
# Tests the ZopeTestCase, eating its own dogfood
# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
#
# NOTE: This is *not* an example TestCase. Do not
# use this file as a blueprint for your own tests!
#
# See testPythonScript.py and testShoppingCart.py for
# example test cases. See testSkeleton.py for a quick
# way of getting started.
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Tests the ZopeTestCase, eating its own dogfood
NOTE: This is *not* an example TestCase. Do not
use this file as a blueprint for your own tests!
See testPythonScript.py and testShoppingCart.py for
example test cases. See testSkeleton.py for a quick
way of getting started.
# $Id: testZopeTestCase.py,v 1.25 2005/01/30 14:22:48 shh42 Exp $
$Id: testZopeTestCase.py,v 1.25 2005/01/30 14:22:48 shh42 Exp $
"""
import os, sys
if __name__ == '__main__':
......
##############################################################################
#
# Parts of ZServer support are in this module so they can
# be imported more selectively.
# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Parts of ZServer support are in this module so they can
be imported more selectively.
# $Id: threadutils.py,v 1.6 2004/08/19 15:31:26 shh42 Exp $
$Id: threadutils.py,v 1.6 2004/08/19 15:31:26 shh42 Exp $
"""
from threading import Thread
from StringIO import StringIO
......
##############################################################################
#
# Utility functions
# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
#
# These functions are designed to be imported and run at
# module level to add functionality to the test environment.
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Utility functions
# $Id: utils.py,v 1.21 2005/02/11 09:00:21 shh42 Exp $
These functions are designed to be imported and run at
module level to add functionality to the test environment.
$Id: utils.py,v 1.21 2005/02/11 09:00:21 shh42 Exp $
"""
def setupCoreSessions(app=None):
'''Sets up the session_data_manager e.a.'''
......
##############################################################################
#
# ZopeTestCase doctest support
# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""ZopeTestCase doctest support
# $Id: __init__.py,v 1.2 2005/03/26 18:07:08 shh42 Exp $
$Id: __init__.py,v 1.2 2005/03/26 18:07:08 shh42 Exp $
"""
__version__ = '0.9.7'
......
##############################################################################
#
# ZopeTestCase
# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
#
# COPY THIS FILE TO YOUR 'tests' DIRECTORY.
#
# This version of framework.py will use the SOFTWARE_HOME
# environment variable to locate Zope and the Testing package.
#
# If the tests are run in an INSTANCE_HOME installation of Zope,
# Products.__path__ and sys.path with be adjusted to include the
# instance's Products and lib/python directories respectively.
#
# If you explicitly set INSTANCE_HOME prior to running the tests,
# auto-detection is disabled and the specified path will be used
# instead.
#
# If the 'tests' directory contains a custom_zodb.py file, INSTANCE_HOME
# will be adjusted to use it.
#
# If you set the ZEO_INSTANCE_HOME environment variable a ZEO setup
# is assumed, and you can attach to a running ZEO server (via the
# instance's custom_zodb.py).
#
##############################################################################
#
# The following code should be at the top of every test module:
#
# import os, sys
# if __name__ == '__main__':
# execfile(os.path.join(sys.path[0], 'framework.py'))
#
# ...and the following at the bottom:
#
# if __name__ == '__main__':
# framework()
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""ZopeTestCase framework
COPY THIS FILE TO YOUR 'tests' DIRECTORY.
This version of framework.py will use the SOFTWARE_HOME
environment variable to locate Zope and the Testing package.
If the tests are run in an INSTANCE_HOME installation of Zope,
Products.__path__ and sys.path with be adjusted to include the
instance's Products and lib/python directories respectively.
If you explicitly set INSTANCE_HOME prior to running the tests,
auto-detection is disabled and the specified path will be used
instead.
If the 'tests' directory contains a custom_zodb.py file, INSTANCE_HOME
will be adjusted to use it.
If you set the ZEO_INSTANCE_HOME environment variable a ZEO setup
is assumed, and you can attach to a running ZEO server (via the
instance's custom_zodb.py).
The following code should be at the top of every test module:
import os, sys
if __name__ == '__main__':
execfile(os.path.join(sys.path[0], 'framework.py'))
...and the following at the bottom:
if __name__ == '__main__':
framework()
$Id:$
"""
__version__ = '0.2.3'
__version__ = '0.2.4'
# Save start state
#
......
##############################################################################
#
# Support for functional doc tests
# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Support for (functional) doc tests
# $Id: functional.py,v 1.2 2005/03/26 18:07:08 shh42 Exp $
$Id: functional.py,v 1.2 2005/03/26 18:07:08 shh42 Exp $
"""
import sys, re, base64
import warnings
......
##############################################################################
#
# Runs all tests in the current directory [and below]
# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
#
# Execute like:
# python runalltests.py [-R]
#
# Alternatively use the testrunner:
# python /path/to/Zope/bin/testrunner.py -qa
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Runs all tests in the current directory [and below]
Execute like:
python runalltests.py [-R]
$Id:$
"""
__version__ = '0.2.1'
import os, sys
if __name__ == '__main__':
......
##############################################################################
#
# Test for auth_header
# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Test for auth_header
# $Id: testAuthHeaderTest.py,v 1.2 2005/03/26 18:07:08 shh42 Exp $
$Id: testAuthHeaderTest.py,v 1.2 2005/03/26 18:07:08 shh42 Exp $
"""
import os, sys
if __name__ == '__main__':
......
##############################################################################
#
# Example functional doctest
# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Example functional doctest
# $Id: testFunctionalDocTest.py,v 1.2 2005/03/26 18:07:08 shh42 Exp $
$Id: testFunctionalDocTest.py,v 1.2 2005/03/26 18:07:08 shh42 Exp $
"""
import os, sys
if __name__ == '__main__':
......
##############################################################################
#
# Example doctest
# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Example doctest
# $Id: testWarningsTest.py,v 1.2 2005/03/26 18:07:08 shh42 Exp $
$Id: testWarningsTest.py,v 1.2 2005/03/26 18:07:08 shh42 Exp $
"""
import os, sys
if __name__ == '__main__':
......
##############################################################################
#
# Example Zope doctest
# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Example Zope doctest
# $Id: testZopeDocTest.py,v 1.2 2005/03/26 18:07:08 shh42 Exp $
$Id: testZopeDocTest.py,v 1.2 2005/03/26 18:07:08 shh42 Exp $
"""
import os, sys
if __name__ == '__main__':
......
##############################################################################
#
# ZopeTestCase public interface
# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""ZopeTestCase public interface
# $Id: __init__.py,v 1.1 2005/02/25 11:01:07 shh42 Exp $
$Id: __init__.py,v 1.1 2005/02/25 11:01:07 shh42 Exp $
"""
__version__ = '0.9.7'
......
##############################################################################
#
# ztc_common.py
# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
#
# This file must be called from framework.py like so
#
# execfile(os.path.join(os.path.dirname(Testing.__file__),
# 'ZopeTestCase', 'ztc_common.py'))
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""ztc_common.py
This file must be called from framework.py like so
# $Id: ztc_common.py,v 1.14 2004/05/27 15:06:24 shh42 Exp $
execfile(os.path.join(os.path.dirname(Testing.__file__),
'ZopeTestCase', 'ztc_common.py'))
$Id: ztc_common.py,v 1.14 2004/05/27 15:06:24 shh42 Exp $
"""
# Overwrites the default framework() method to expose the
# TestRunner parameters and add profiler support.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment