-
Notifications
You must be signed in to change notification settings - Fork 31
Set up for dot-env. #655
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
base: main
Are you sure you want to change the base?
Set up for dot-env. #655
Conversation
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.
Pull request overview
This PR adds support for python-dotenv to enable easier local testing of AWS and GDrive functionality by allowing developers to store test credentials in a .env file. The changes maintain backward compatibility with GitHub Actions while providing a more convenient way to manage test credentials locally.
- Adds
python-dotenvintegration to load environment variables from a.envfile - Updates documentation in test utility functions to explain the dotenv usage
- Adds
.envto.gitignoreto prevent accidental credential commits
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
.gitignore |
Adds .env file exclusion to prevent test credentials from being committed |
tests/tests_transfers/aws/aws_test_utils.py |
Imports and uses load_dotenv() for loading AWS test credentials, updates documentation and fixes "GitHub" capitalization |
tests/tests_transfers/gdrive/gdrive_test_utils.py |
Imports and uses load_dotenv() for loading GDrive test credentials, adds documentation about dotenv usage |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if not load_dotenv(): | ||
| return False |
Copilot
AI
Dec 19, 2025
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.
The logic here will incorrectly return False if environment variables are set manually (not via .env file) when not running on GitHub Actions. The load_dotenv() function returns False when no .env file is found, even if the required environment variables are already set in the environment. Consider calling load_dotenv() without checking its return value, or restructure the logic to only use load_dotenv() as an attempt to load variables, not as a requirement.
| if not load_dotenv(): | |
| return False | |
| # Best-effort load from .env for local development; ignore return value | |
| load_dotenv() |
| if not load_dotenv(): | ||
| return False |
Copilot
AI
Dec 19, 2025
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.
The logic here will incorrectly return False if environment variables are set manually (not via .env file) when not running on GitHub Actions. The load_dotenv() function returns False when no .env file is found, even if the required environment variables are already set in the environment. Consider calling load_dotenv() without checking its return value, or restructure the logic to only use load_dotenv() as an attempt to load variables, not as a requirement.
| if not load_dotenv(): | |
| return False | |
| # Attempt to load variables from a .env file if present, but do not | |
| # treat the absence of a .env file as a failure condition. | |
| load_dotenv() |
This PR allows
python-dotenvto be used to set environment variables for the AWS and GDrive tests. This makes it much easier to run the tests locally.