Exemplo n.º 1
0
Arquivo: export.py Projeto: happz/tmt
def create_nitrate_case(test):
    """ Create new nitrate case """
    import_nitrate()

    # Get category from Makefile
    try:
        with open('Makefile', encoding='utf-8') as makefile_file:
            makefile = makefile_file.read()
        category = re.search(r'echo\s+"Type:\s*(.*)"', makefile, re.M).group(1)
    # Default to 'Sanity' if Makefile or Type not found
    except (IOError, AttributeError):
        category = 'Sanity'

    # Create the new test case
    summary = test.node.get('extra-summary', test.summary)
    category = nitrate.Category(name=category, product=DEFAULT_PRODUCT)
    testcase = nitrate.TestCase(summary=summary, category=category)
    echo(style(f"Test case '{testcase.identifier}' created.", fg='blue'))
    return testcase
Exemplo n.º 2
0
Arquivo: export.py Projeto: pkis/tmt
def create_nitrate_case(test):
    """ Create new nitrate case """
    import_nitrate()

    # Get category from Makefile
    try:
        with open('Makefile', encoding='utf-8') as makefile_file:
            makefile = makefile_file.read()
        category = re.search(r'echo\s+"Type:\s*(.*)"', makefile, re.M).group(1)
    # Default to 'Sanity' if Makefile or Type not found
    except (IOError, AttributeError):
        category = 'Sanity'

    # Create the new test case
    remote_dirname = re.sub('.git$', '', os.path.basename(test.fmf_id['url']))
    if not remote_dirname:
        raise ConvertError("Unable to find git remote url.")
    summary = test.node.get('extra-summary', (remote_dirname or "") +
                            (test.name or "") + ' - ' + (test.summary or ""))
    category = nitrate.Category(name=category, product=DEFAULT_PRODUCT)
    testcase = nitrate.TestCase(summary=summary, category=category)
    echo(style(f"Test case '{testcase.identifier}' created.", fg='blue'))
    return testcase
Exemplo n.º 3
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())