-
Notifications
You must be signed in to change notification settings - Fork 8
Don't run if CI isn't set #71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This should quiet these warnings when running pytest locally on developer machines outside of CI: ``` buildkite-test-collector - WARNING - No BUILDKITE_ANALYTICS_TOKEN environment variable present ``` Based on the README, I think this was already the intent: > Run your tests like normal. Note that we attempt to detect the presence of several common CI environments, however if this fails you can set the `CI` environment variable to any value and it will work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @jmsanders, thanks for opening the PR.
We’ve intentionally removed the CI
env requirements (see #46) because we want the collector to run outside of CI
for debugging purpose. Your changes only skip the upload process when the CI
env is missing, which is a valid case. I'm happy with the changes, but could you please rename the variable to ENV_CI
for clarity?
@@ -12,20 +12,26 @@ | |||
class API: | |||
"""Buildkite Test Engine API client""" | |||
|
|||
CI_TOKEN = "CI" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CI_TOKEN = "CI" | |
ENV_CI = "CI" |
ENV_TOKEN = "BUILDKITE_ANALYTICS_TOKEN" | ||
ENV_API_URL = "BUILDKITE_ANALYTICS_API_URL" | ||
|
||
DEFAULT_API_URL = "https://analytics-api.buildkite.com/v1" | ||
|
||
def __init__(self, env: Mapping[str, Optional[str]]): | ||
"""Initialize the API client with environment variables""" | ||
self.ci = env.get(self.CI_TOKEN) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.ci = env.get(self.CI_TOKEN) | |
self.ci = env.get(self.ENV_CI) |
Sure thing - changed. |
This should quiet these warnings when running pytest locally on developer machines outside of CI:
Based on the README, I think this was already the intent: