コード例 #1
0
ファイル: export.py プロジェクト: happz/tmt
def import_nitrate():
    """ Conditionally import the nitrate module """
    # Need to import nitrate only when really needed. Otherwise we get
    # traceback when nitrate not installed or config file not available.
    # And we want to keep the core tmt package with minimal dependencies.
    try:
        global nitrate, DEFAULT_PRODUCT
        import nitrate
        DEFAULT_PRODUCT = nitrate.Product(name='RHEL Tests')
    except ImportError:
        raise ConvertError("Install nitrate to export tests there.")
    except nitrate.NitrateError as error:
        raise ConvertError(error)
コード例 #2
0
#!/usr/bin/python
""" Prepare test bed - create Test Cases, Test Plans and Test Runs """

import nitrate
import random
import optparse

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Global Constants
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

MASTER_TESTPLAN_NAME = "Master Test Plan"
PRODUCT = nitrate.Product(name="RHEL Tests")
VERSION = nitrate.Version(product=PRODUCT, version="unspecified")
PLANTYPE = nitrate.PlanType(name="Function")
CATEGORY = nitrate.Category(category="Regression", product=PRODUCT)
CASESTATUS = nitrate.CaseStatus("CONFIRMED")
BUILD = nitrate.Build(product=PRODUCT, build="unspecified")

TAGS = [nitrate.Tag(id) for id in range(3000, 3200)]
TESTERS = [nitrate.User(id) for id in range(1000, 1050)]

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Parse Options
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


def parse_options():
    parser = optparse.OptionParser(
        usage="test-bed-prepare [--plans #] [--runs #] [--cases #]",
        description=__doc__.strip())