Example #1
0
def runZopeTests(options):
    from zope import testrunner
    from zope.testrunner.options import setup

    def load_config_file(option, opt, config_file, *ignored):
        print "Parsing %s" % config_file
        import Zope2
        Zope2.configure(config_file)

    setup.add_option('--config-file',
                     action='callback',
                     type='string',
                     dest='config_file',
                     callback=load_config_file)

    defaults = '--tests-pattern ^tests$ -v'.split()
    defaults += ['--config-file', CONFIG]

    if '-m' not in options:
        defaults += [
            '-m', '!^('
            'ZConfig'
            '|'
            'BTrees'
            '|'
            'persistent'
            '|'
            'ThreadedAsync'
            '|'
            'transaction'
            '|'
            'ZEO'
            '|'
            'ZODB'
            '|'
            'ZopeUndo'
            '|'
            'zdaemon'
            '|'
            'zope[.]testing'
            '|'
            'zope[.]app'
            ')[.]'
        ]

    defaults += ['--path', SOFTWARE_HOME]
    defaults += ['--package-path', PRODUCTS, 'Products']
    sys.exit(testrunner.run(defaults, options))
Example #2
0
def runZopeTests(options):
    from zope import testrunner
    from zope.testrunner.options import setup

    def load_config_file(option, opt, config_file, *ignored):
        print "Parsing %s" % config_file
        import Zope2
        Zope2.configure(config_file)

    setup.add_option( '--config-file', action='callback', type='string',
                     dest='config_file', callback=load_config_file)

    defaults = '--tests-pattern ^tests$ -v'.split()
    defaults += ['--config-file', CONFIG]

    if '-m' not in options:
        defaults += ['-m',
                     '!^('
                     'ZConfig'
                     '|'
                     'BTrees'
                     '|'
                     'persistent'
                     '|'
                     'ThreadedAsync'
                     '|'
                     'transaction'
                     '|'
                     'ZEO'
                     '|'
                     'ZODB'
                     '|'
                     'ZopeUndo'
                     '|'
                     'zdaemon'
                     '|'
                     'zope[.]testing'
                     '|'
                     'zope[.]app'
                     ')[.]']

    defaults += ['--path', SOFTWARE_HOME]
    defaults += ['--package-path', PRODUCTS, 'Products']
    sys.exit(testrunner.run(defaults, options))
Example #3
0
# -*- coding: utf-8 -*-
"""
Script to run zope.testrunner in a gevent monkey-patched environment.

Using ``python -m gevent.monkey zope-testrunner ...`` is insufficient.

This is because up through 1.5a2 there is a serious bug in the way the
monkey-patcher patches the spawned process. The net effect is that the gevent
threadpool isn't functional.

"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import gevent.monkey
gevent.monkey.patch_all()
# pylint:disable=wrong-import-position, wrong-import-order
import sys

from zope.testrunner import run

sys.argv[:] = [
    'zope-testrunner',
    '--test-path=src',
    '-vvv',
    '--color',
] + sys.argv[1:]
print(sys.argv)
run()
Example #4
0
 def _run():
     run(args=args)
Example #5
0
 def _run():
     run(args=args)
Example #6
0
##############################################################################
#
# Copyright (c) 2013 Zope Foundation 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.
#
##############################################################################

if __name__ == '__main__':
    # allow people to try out the test runner with
    # python -m zope.testrunner --test-path .
    from zope.testrunner import run
    run()