Skip to content

Commit

Permalink
Add support for token env var (#137)
Browse files Browse the repository at this point in the history
  • Loading branch information
CFSNM authored Mar 18, 2024
1 parent 4595c2e commit 8acf19d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,14 @@ Usage
# connection_error_strategy [strict|skip|ignore] Choose how to handle connection errors
# return_jira_metadata = False (return Jira issue with metadata instead of boolean result)
You can set the password and username fields by setting the PYTEST_JIRA_PASSWORD and PYTEST_JIRA_USERNAME
environment variables:
You can set the password and username fields by setting the PYTEST_JIRA_PASSWORD, PYTEST_JIRA_USERNAME and
PYTEST_JIRA_TOKEN environment variables:

.. code:: sh
export PYTEST_JIRA_PASSWORD="FOO"
export PYTEST_JIRA_USERNAME="BAR"
export PYTEST_JIRA_TOKEN="TOKEN"
Configuration options can be overridden with command line options as well.
For all available command line options run following command.
Expand Down
3 changes: 2 additions & 1 deletion pytest_jira.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
PLUGIN_NAME = "jira_plugin"
PASSWORD_ENV_VAR = 'PYTEST_JIRA_PASSWORD'
USERNAME_ENV_VAR = 'PYTEST_JIRA_USERNAME'
TOKEN_ENV_VAR = 'PYTEST_JIRA_TOKEN'


class JiraHooks(object):
Expand Down Expand Up @@ -549,7 +550,7 @@ def pytest_configure(config):
os.getenv(USERNAME_ENV_VAR) or config.getvalue('jira_username'),
os.getenv(PASSWORD_ENV_VAR) or config.getvalue('jira_password'),
config.getvalue('jira_verify'),
config.getvalue('jira_token'),
os.getenv(TOKEN_ENV_VAR) or config.getvalue('jira_token'),
)
jira_marker = JiraMarkerReporter(
config.getvalue('jira_marker_strategy'),
Expand Down

0 comments on commit 8acf19d

Please sign in to comment.