Skip to content
This repository has been archived by the owner on Apr 7, 2022. It is now read-only.

Commit

Permalink
[RFR] Updated bz coverage utility to not update bugs in coverage= mar…
Browse files Browse the repository at this point in the history
…ker (#10130)

* Updated bz coveraage utility to not update flags for bugs in coverage= and replaced log msg with exception when no bz creds

* Remove remaining coverage references

* Remove changes to bz.py

* Remove changes to bzs.py

* Add option --inc_man to coverage() and set option to false by default

* Add check for user or key attributes and error out if both are missing

* Apply suggestions from code review

Updating arg to include_manual

Co-authored-by: john-dupuy <[email protected]>

* Update cfme/scripting/bz.py

missed one of the include_manual changes

Co-authored-by: Mike Shriver <[email protected]>
Co-authored-by: john-dupuy <[email protected]>
  • Loading branch information
3 people authored May 21, 2020
1 parent b203ee5 commit 2b7a842
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions cfme/scripting/bz.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

from cfme.utils import conf
from cfme.utils.blockers import BZ
from cfme.utils.bz import Bugzilla
from cfme.utils.log import logger
from cfme.utils.path import data_path
from cfme.utils.version import current_version
Expand All @@ -44,18 +45,24 @@
BZ_URL = conf.env.bugzilla.url


def get_report(directory):
def get_report(directory, include_manual=True):
bz_instance = Bugzilla.from_config()
if not (bz_instance.user or bz_instance.key):
msg = ("ERROR: Credentials key for bugzilla does not have username or api key.")
click.secho(msg, err=True, bold=True, fg="red")
sys.exit(0)
click.echo("Generating a BZ report in bz-report.yaml")
pytest.main([
"--use-provider", "complete",
options = ["--use-provider", "complete",
"--long-running",
"--use-template-cache",
"--collect-only",
"--dummy-appliance",
"--include-manual",
"-q",
"--generate-bz-report", directory
])
"--generate-bz-report"
]
if include_manual:
options.append("--include-manual")
pytest.main(options.append(directory))
# read the generated yaml
try:
with open("bz-report.yaml") as stream:
Expand Down Expand Up @@ -224,6 +231,15 @@ def list(directory, bz_status):

@main.command(help="Set QE test coverage flag based on automates/coverage metadata")
@click.argument("directory", default="cfme/tests")
@click.option(
"-m",
"--include-manual",
"include_manual",
is_flag=True,
help="Include BZs that are marked in coverage test metadata for manual tests",
default=False,
show_default=True
)
@click.option(
"-s",
"--set",
Expand Down Expand Up @@ -263,8 +279,8 @@ def list(directory, bz_status):
show_default=True,
flag_value="closed_bzs"
)
def coverage(directory, set_bzs, bz_status):
info = get_report(directory)
def coverage(directory, include_manual, set_bzs, bz_status):
info = get_report(directory, include_manual=include_manual)

# get list of bzs that should have test coverage set
bz_list = get_qe_test_coverage(info, bz_status)
Expand Down

0 comments on commit 2b7a842

Please sign in to comment.