File tree Expand file tree Collapse file tree 3 files changed +24
-1
lines changed
Expand file tree Collapse file tree 3 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -19,3 +19,14 @@ release: clean
1919sdist : clean
2020 python setup.py sdist
2121 ls -l dist
22+
23+ test :
24+ pip install -e .
25+ py.test tests/
26+
27+ coverage :
28+ coverage run --source=dotenv.py --omit=' *tests*' -m py.test tests/ -v --tb=native
29+ coverage report
30+
31+ coverage-html : coverage
32+ coverage html
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ def load_dotenv(dotenv_path):
1515 Read a .env file and load into os.environ.
1616 """
1717 if not os .path .exists (dotenv_path ):
18- warnings .warn ("can't read %s - it doesn't exist." % dotenv_path )
18+ warnings .warn ("Not loading %s - it doesn't exist." % dotenv_path )
1919 return None
2020 for k , v in parse_dotenv (dotenv_path ):
2121 os .environ .setdefault (k , v )
Original file line number Diff line number Diff line change 1+ import warnings
2+
3+ from dotenv import load_dotenv
4+
5+
6+ def test_warns_if_file_does_not_exist ():
7+ with warnings .catch_warnings (record = True ) as w :
8+ load_dotenv ('.does_not_exist' )
9+
10+ assert len (w ) == 1
11+ assert w [0 ].category is UserWarning
12+ assert str (w [0 ].message ) == "Not loading .does_not_exist - it doesn't exist."
You can’t perform that action at this time.
0 commit comments