Use pytest-env to set up API key shims for testing #1382
Labels
🤖 aspect: dx
Concerns developers' experience with the codebase
✨ goal: improvement
Improvement to an existing user-facing feature
good first issue
New-contributor friendly
help wanted
Open to participation from the community
🟩 priority: low
Low priority and doesn't need to be rushed
🧱 stack: catalog
Related to the catalog and Airflow DAGs
🐳 tech: docker
Involves Docker
🐍 tech: python
Involves Python
Problem
Presently we use a copy of the
env.template
file when testing (via thejust dotenv
recipe here in the CI/CD workflow)The env template includes placeholders for the various API keys we use:
https://github.com/WordPress/openverse-catalog/blob/895e907b6f9594b4d43db6a07eae0b3cb4a0e7d0/env.template#L27-L34
Per @krysal's comment (WordPress/openverse-catalog#795 (comment)):
Description
We should comment these fields out from the
env.template
file but still keep them present as examples (just like theenv.template
files for the API). Particularly now that we are no longer retrieving those values at DAG parse time as part of the provider refactor, we no longer need to have these defined in the environment whenever running the project. Leaving them undefined will give us more obvious errors during local DAG testing if we happen to forget to populate a variable.We do need placeholder values for testing though. That's where we might use the pytest-env plugin to define these with placeholders in the
pytest.ini
file.Implementation
The text was updated successfully, but these errors were encountered: