def start_http(address, port):
    import sys
    from ZServer import asyncore
    from ZServer import zhttp_server, zhttp_handler
    import socket

    import Zope # Sigh, make product initialization happen
    try:
        Zope.startup()
    except: # Zope > 2.6
        pass

    from ZServer import setNumberOfThreads
    setNumberOfThreads(4)

    try:
        hs = zhttp_server(
            ip=address,
            port=port,
            resolver=None,
            logger_object=None)
    except socket.error, why:
        if why[0] == 98: # address in use
            raise port_err % {'port':port,
                              'socktype':'TCP',
                              'protocol':'HTTP',
                              'switch':'-w'}
        raise
示例#2
0
 def setUp(self):
     """ """
     import Zope
     Zope.startup()
     self.connection = Zope.DB.open()
     get_transaction().begin()
     try:
         self.root = makerequest.makerequest(self.connection.root()['Application'])
     except:
         print "error1"
         self.tearDown()
         raise
示例#3
0
def test_suite():

    import Zope

    try:
        Zope.startup()
    except AttributeError:  # Zope <= 2.6.0
        pass

    from Products.CMFCore.tests.base.utils import build_test_suite

    suite = unittest.TestSuite()

    packages = PACKAGES_UNDER_TEST or CMF_PACKAGES

    for package_name, required in packages:
        dotted = 'Products.%s.tests' % package_name
        suite.addTest( build_test_suite( dotted
                                       , [ 'test_all' ]
                                       , required=required
                                       ) )

    return suite
示例#4
0
def test_suite():
    import Zope
    if hasattr(Zope,'startup'):
        Zope.startup()
    suite = TestSuite()
    from test_AcquireUsage import test_suite
    suite.addTest(test_suite())
    from test_Creation import test_suite
    suite.addTest(test_suite())
    from test_PythonScriptUsage import test_suite
    suite.addTest(test_suite())
    from test_ContainedUsage import test_suite
    suite.addTest(test_suite())
    from test_SQLUsage import test_suite
    suite.addTest(test_suite())
    from test_SubclassUsage import test_suite
    suite.addTest(test_suite())
    from test_Unconfigured import test_suite
    suite.addTest(test_suite())
    from test_Broken import test_suite
    suite.addTest(test_suite())
    from test_User import test_suite
    suite.addTest(test_suite())
    return suite
示例#5
0
文件: test_all.py 项目: goschtl/zope
# 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 for CMFStaging.

$Id$
"""

import unittest
import Testing
import Zope
Zope.startup()

from Products.CMFStaging.tests.testLockTool import test_suite as lock_tests
from Products.CMFStaging.tests.testVersions import test_suite as version_tests
from Products.CMFStaging.tests.testStaging import test_suite as staging_tests

def suite():
    suite = unittest.TestSuite()
    suite.addTest(lock_tests())
    suite.addTest(version_tests())
    suite.addTest(staging_tests())
    return suite

def test_suite():
    # Just to silence the top-level test.py
    return None
示例#6
0
文件: testcase.py 项目: goschtl/zope
 def setUp( self ):
     if hasattr(Zope, 'startup'):
         Zope.startup()
     get_transaction().begin()
     self.connection = Zope.DB.open()
     self.root =  self.connection.root()[ 'Application' ]
示例#7
0
import Zope
Zope.startup()
from unittest import TestCase
from AccessControl.SecurityManagement import newSecurityManager
from AccessControl.SecurityManagement import noSecurityManager
from AccessControl.SecurityManager import setSecurityPolicy
from Testing.makerequest import makerequest
from security import PermissiveSecurityPolicy, AnonymousUser
from dummy import DummyFolder
from os.path import join, abspath, dirname
from os import curdir, mkdir, stat, remove
from shutil import copytree, rmtree
from tempfile import mktemp
import os
import sys
import time


class TransactionalTest(TestCase):
    def setUp(self):
        if hasattr(Zope, 'startup'):
            Zope.startup()
        get_transaction().begin()
        self.connection = Zope.DB.open()
        self.root = self.connection.root()['Application']

    def tearDown(self):
        get_transaction().abort()
        self.connection.close()

示例#8
0
 def setUp( self ):
     if hasattr(Zope, 'startup'):
         Zope.startup()
     get_transaction().begin()
     self.connection = Zope.DB.open()
     self.root =  self.connection.root()[ 'Application' ]