From a26bd9b4a33b9fa19c7446e29c2b775c18ce622e Mon Sep 17 00:00:00 2001 From: Meni Yakove Date: Thu, 9 Jan 2020 16:50:41 +0200 Subject: [PATCH] Fix CI fail after api_key support was merged. --- pytest_marker_bugzilla.py | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/pytest_marker_bugzilla.py b/pytest_marker_bugzilla.py index 33b60a4..1ec07ac 100644 --- a/pytest_marker_bugzilla.py +++ b/pytest_marker_bugzilla.py @@ -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()