コード例 #1
0
ファイル: run_tests.py プロジェクト: pvo/backfire
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.

import gettext
import os
import sys

import dtest

import base


if __name__ == '__main__':
    # First, pull in the DTest options
    opts = dtest.optparser(usage="%prog [options]")

    # Add on backfire-specific options
    base.add_opts(opts)

    # Process command-line arguments
    (options, args) = opts.parse_args()

    # Extract the backfire-specific options into storage everything
    # can get to; also handles some defaults
    base.extract_opts(options)

    # Obtain the arguments for dtest.main()
    kwargs = dtest.opts_to_args(options)

    # If --stress is given, activate the stress tests
コード例 #2
0
ファイル: run_tests.py プロジェクト: klmitch/dtest
@dtest.istest
def test_partner_setUp():
    # Look up setUpRun and make sure it's right
    setUpRun = sys.modules['tests.test_partner'].setUpRun
    util.assert_false(setUpRun)


@dtest.istest
def test_partner_tearDown():
    # Look up tearDownRun and make sure it's right
    tearDownRun = sys.modules['tests.test_partner'].tearDownRun
    util.assert_false(tearDownRun)


# Start by processing the command-line arguments
(options, args) = dtest.optparser(usage="%prog [options]").parse_args()

# Get the options
opts = dtest.opts_to_args(options)

# If directory isn't set, use "tests"
if 'directory' not in opts:
    opts['directory'] = 'tests'

# Need to allocate a queue; select some suboptions for the task
subopts = {'skip': lambda dt: hasattr(dt, 'must_skip') and dt.must_skip}
if 'maxth' in opts:
    subopts['maxth'] = opts['maxth']
if 'output' in opts:
    subopts['output'] = opts['output']
queue = dtest.DTestQueue(**subopts)
コード例 #3
0
ファイル: run_tests.py プロジェクト: aabes/keystone
    opts.add_option("-u", "--username",
                    action="store", type="string", dest="username",
                    help="The username to use to access Keystone.")
    opts.add_option("-p", "--password",
                    action="store", type="string", dest="password",
                    help="The password to use to access Keystone.")
    opts.add_option("-k", "--keystone",
                    action="store", type="string", dest="keystone",
                    help="The URL to use to access Keystone.")

    return opts


if __name__ == '__main__':
    # Obtain the options
    opts = add_opts(dtest.optparser(usage="%prog [options]"))

    # Process command-line arguments, saving them so tests can get to
    # them
    (base.options, args) = opts.parse_args()

    # Ensure required options are present
    if (not base.options.username or not base.options.password or
        not base.options.keystone):
        print >>sys.stderr, "Missing required options"
        print >>sys.stderr, ("At a minimum, --username, --password, and "
                             "--keystone must be specified.")
        opts.print_help(sys.stderr)
        sys.exit(1)

    # Execute the test suite