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()