Skip to content

Commit 28441c8

Browse files
authored
Merge pull request #50 from myakove/fix-tests-failed-after-intrudeced-apikey
Fix CI fail after api_key support was merged.
2 parents a7f2266 + a26bd9b commit 28441c8

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

pytest_marker_bugzilla.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -326,21 +326,19 @@ def pytest_configure(config):
326326
"markers",
327327
"bugzilla(*bug_ids, **guards): Bugzilla integration",
328328
)
329-
330-
bz = None
331-
if config.getvalue("bugzilla") and config.getvalue('bugzilla_url'):
332-
url = config.getvalue('bugzilla_url')
333-
if config.getvalue('bugzilla_username') and config.getvalue('bugzilla_password'):
334-
user = config.getvalue('bugzilla_username')
335-
password = config.getvalue('bugzilla_password')
336-
bz = bugzilla.Bugzilla(url=url, user=user, password=password)
337-
elif config.getvalue('bugzilla_api_key'):
338-
api_key = config.getvalue('bugzilla_api_key')
329+
330+
url = config.getvalue('bugzilla_url')
331+
username = config.getvalue('bugzilla_username')
332+
password = config.getvalue('bugzilla_password')
333+
api_key = config.getvalue('bugzilla_api_key')
334+
if config.getvalue("bugzilla") and url:
335+
if username and password:
336+
bz = bugzilla.Bugzilla(url=url, user=username, password=password)
337+
elif api_key:
339338
bz = bugzilla.Bugzilla(url=url, api_key=api_key)
339+
else:
340+
bz = bugzilla.Bugzilla(url=url)
340341

341-
if not bz:
342-
raise Exception('Please specify a valid bugzilla_username + bugzilla_password or a valid bugzilla_api_key')
343-
344342
version = config.getvalue('bugzilla_version')
345343
loose = [
346344
x.strip()

0 commit comments

Comments
 (0)