-
-
Notifications
You must be signed in to change notification settings - Fork 144
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
make DOTENV setting more robust #364
base: master
Are you sure you want to change the base?
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.
Than ks for. the contribution and sorry it has taken so long for this to be reviewed.
Can you add a small unit test to the tests/test_env.py for using the DOTENV as a dictionary?
6e04278
to
8a6530a
Compare
Oh wow. I completely forgot about this PR, but I've written a quick test just now and added it to |
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.
Thanks for jumping on that so quickly.
Think just the one noted issue should solve the Actions failures
tests/test_env.py
Outdated
DJANGO_CONFIGURATION='DotEnvConfiguration', | ||
DJANGO_SETTINGS_MODULE='tests.settings.dot_env_dict') | ||
def test_env_dict(self): | ||
from tests.settings import dot_env |
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.
This should be from tests.settings import tests.settings.dot_env_dict
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.
Yeah that was a silly oversight. I would normally run test locally but I'm currently on NixOS and don't have time to read how to use tox with it
8a6530a
to
889b40a
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #364 +/- ##
==========================================
+ Coverage 89.98% 90.62% +0.64%
==========================================
Files 25 27 +2
Lines 1198 1227 +29
Branches 216 89 -127
==========================================
+ Hits 1078 1112 +34
+ Misses 89 87 -2
+ Partials 31 28 -3 ☔ View full report in Codecov by Sentry. |
These flake8 issues need sorting:
|
889b40a
to
8aadc82
Compare
Lookxs like we need to add a test that passes an invalid/non-existent .env file in so that the OSError exception is triggered to achieve the desired code coverage set on this project. |
Add additional config options to DOTENV while retaining compatibility with the old way of setting it
8aadc82
to
bc11925
Compare
I've added the opposite test since DOTENV being required is the default behavior. It tries to use nonexistent DOTENV path and since required is set to False it shouldn't raise an exception |
@pauloxnet - are you happy for this to be merged now? |
@cclauss - do you have any comments/issues with this PR being merged? |
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.
Looks good to me
It seems a change of behaviors to me. |
Can you provide details on how you think it has changed please? Furthermore, there is no change to any unit tests so I am struggling to see how this has affected existing functionality. |
While adding
django-configuratons
to a big project that I'm working on I've noticed a few issues withDOTENV
implementation and this PR focuses on fixing them, while still allowing for the old way of doing this. They are:.env
)DOTENV
)