-
Notifications
You must be signed in to change notification settings - Fork 214
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
Use pytest-env to set up API key #3272
Conversation
@AetherUnbound |
@ngken0995 thanks for taking this on! We don't use a Pipfile for the catalog because Airflow comes with its own constraints file which we use when building the Docker image. Instead please add the openverse/catalog/requirements_dev.txt Lines 1 to 12 in d92c22a
I think the CI might be failing because the requirement is missing from that file and in the (currently unused) Pipfile instead! |
Oh one other note, all of the |
Update: I confirmed that with the following changes, diff --git a/catalog/pytest.ini b/catalog/pytest.ini
index 48029dcc4..96cafe324 100644
--- a/catalog/pytest.ini
+++ b/catalog/pytest.ini
@@ -41,14 +41,14 @@ filterwarnings=
cache_dir=/home/airflow/.cache/pytest
env =
- API_KEY_BROOKLYN_MUSEUM=apikey
- API_KEY_DATA_GOV=apikey
- API_KEY_EUROPEANA=apikey
- API_KEY_FLICKR=apikey
- API_KEY_FREESOUND=apikey
- API_KEY_JAMENDO=apikey
- API_KEY_JUSTTAKEITFREE=apikey
- API_KEY_NYPL=apikey
- API_KEY_RAWPIXEL=apikey
- API_KEY_THINGIVERSE=apikey
- API_KEY_WALTERS_ART_MUSEUM=apikey
+ AIRFLOW_VAR_API_KEY_BROOKLYN_MUSEUM=apikey
+ AIRFLOW_VAR_API_KEY_DATA_GOV=apikey
+ AIRFLOW_VAR_API_KEY_EUROPEANA=apikey
+ AIRFLOW_VAR_API_KEY_FLICKR=apikey
+ AIRFLOW_VAR_API_KEY_FREESOUND=apikey
+ AIRFLOW_VAR_API_KEY_JAMENDO=apikey
+ AIRFLOW_VAR_API_KEY_JUSTTAKEITFREE=apikey
+ AIRFLOW_VAR_API_KEY_NYPL=apikey
+ AIRFLOW_VAR_API_KEY_RAWPIXEL=apikey
+ AIRFLOW_VAR_API_KEY_THINGIVERSE=apikey
+ AIRFLOW_VAR_API_KEY_WALTERS_ART_MUSEUM=apikey
diff --git a/catalog/requirements_dev.txt b/catalog/requirements_dev.txt
index d1e577fa5..00821c9c0 100644
--- a/catalog/requirements_dev.txt
+++ b/catalog/requirements_dev.txt
@@ -10,3 +10,4 @@ pytest-raises==0.11
pytest-socket==0.6.0
pytest-sugar==0.9.7
pytest-xdist
+pytest-env |
@AetherUnbound Thank you, I will always check where to install new dependencies. |
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.
These changes look great, and runs great locally when I comment out my API keys! I have one note on the env template, otherwise this is good to go 😄
catalog/env.template
Outdated
#AIRFLOW_VAR_API_KEY_BROOKLYN_MUSEUM=not_set | ||
#AIRFLOW_VAR_API_KEY_DATA_GOV=not_set | ||
#AIRFLOW_VAR_API_KEY_EUROPEANA=not_set | ||
#AIRFLOW_VAR_API_KEY_FLICKR=not_set | ||
#AIRFLOW_VAR_API_KEY_FREESOUND=not_set | ||
#AIRFLOW_VAR_API_KEY_JAMENDO=not_set | ||
#AIRFLOW_VAR_API_KEY_JUSTTAKEITFREE=not_set | ||
#AIRFLOW_VAR_API_KEY_NYPL=not_set | ||
#AIRFLOW_VAR_API_KEY_RAWPIXEL=not_set | ||
#AIRFLOW_VAR_API_KEY_THINGIVERSE=not_set | ||
#AIRFLOW_VAR_API_KEY_WALTERS_ART_MUSEUM=not_set |
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.
**I actually think we can do away with most of these, maybe leaving one as an example!
#AIRFLOW_VAR_API_KEY_BROOKLYN_MUSEUM=not_set | |
#AIRFLOW_VAR_API_KEY_DATA_GOV=not_set | |
#AIRFLOW_VAR_API_KEY_EUROPEANA=not_set | |
#AIRFLOW_VAR_API_KEY_FLICKR=not_set | |
#AIRFLOW_VAR_API_KEY_FREESOUND=not_set | |
#AIRFLOW_VAR_API_KEY_JAMENDO=not_set | |
#AIRFLOW_VAR_API_KEY_JUSTTAKEITFREE=not_set | |
#AIRFLOW_VAR_API_KEY_NYPL=not_set | |
#AIRFLOW_VAR_API_KEY_RAWPIXEL=not_set | |
#AIRFLOW_VAR_API_KEY_THINGIVERSE=not_set | |
#AIRFLOW_VAR_API_KEY_WALTERS_ART_MUSEUM=not_set | |
# Example: | |
# AIRFLOW_VAR_API_KEY_BROOKLYN_MUSEUM=apikey |
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.
Awesome, nice to simplify the variable creation, @ngken0995!
Fixes
Fixes #1382 by @AetherUnbound
Description
AIRFLOW_VAR_API_KEY
AIRFLOW_VAR_API_KEY
are placed incatalog/pytest.ini
Testing Instructions
Checklist
Update index.md
).main
) or a parent feature branch.Developer Certificate of Origin
Developer Certificate of Origin