Skip to content

Commit

Permalink
Merge pull request #50 from myakove/fix-tests-failed-after-intrudeced…
Browse files Browse the repository at this point in the history
…-apikey

Fix CI fail after api_key support was merged.
  • Loading branch information
els-pnw authored Jan 9, 2020
2 parents a7f2266 + a26bd9b commit 28441c8
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions pytest_marker_bugzilla.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,21 +326,19 @@ def pytest_configure(config):
"markers",
"bugzilla(*bug_ids, **guards): Bugzilla integration",
)

bz = None
if config.getvalue("bugzilla") and config.getvalue('bugzilla_url'):
url = config.getvalue('bugzilla_url')
if config.getvalue('bugzilla_username') and config.getvalue('bugzilla_password'):
user = config.getvalue('bugzilla_username')
password = config.getvalue('bugzilla_password')
bz = bugzilla.Bugzilla(url=url, user=user, password=password)
elif config.getvalue('bugzilla_api_key'):
api_key = config.getvalue('bugzilla_api_key')

url = config.getvalue('bugzilla_url')
username = config.getvalue('bugzilla_username')
password = config.getvalue('bugzilla_password')
api_key = config.getvalue('bugzilla_api_key')
if config.getvalue("bugzilla") and url:
if username and password:
bz = bugzilla.Bugzilla(url=url, user=username, password=password)
elif api_key:
bz = bugzilla.Bugzilla(url=url, api_key=api_key)
else:
bz = bugzilla.Bugzilla(url=url)

if not bz:
raise Exception('Please specify a valid bugzilla_username + bugzilla_password or a valid bugzilla_api_key')

version = config.getvalue('bugzilla_version')
loose = [
x.strip()
Expand Down

0 comments on commit 28441c8

Please sign in to comment.