@@ -74,14 +74,19 @@ def test_get_key_no_file(tmp_path):
7474 nx_file = str (tmp_path / "nx" )
7575 logger = logging .getLogger ("dotenv.main" )
7676
77- with mock .patch .object (logger , "warning" ) as mock_warning :
77+ with mock .patch .object (logger , "info" ) as mock_info , \
78+ mock .patch .object (logger , "warning" ) as mock_warning :
7879 result = dotenv .get_key (nx_file , "foo" )
7980
8081 assert result is None
82+ mock_info .assert_has_calls (
83+ calls = [
84+ mock .call ("Python-dotenv could not find configuration file %s." , nx_file )
85+ ],
86+ )
8187 mock_warning .assert_has_calls (
8288 calls = [
83- mock .call ("File doesn't exist %s" , nx_file ),
84- mock .call ("Key %s not found in %s." , "foo" , nx_file ),
89+ mock .call ("Key %s not found in %s." , "foo" , nx_file )
8590 ],
8691 )
8792
@@ -228,10 +233,10 @@ def test_load_dotenv_existing_file(dotenv_file):
228233def test_load_dotenv_no_file_verbose ():
229234 logger = logging .getLogger ("dotenv.main" )
230235
231- with mock .patch .object (logger , "warning " ) as mock_warning :
236+ with mock .patch .object (logger , "info " ) as mock_info :
232237 dotenv .load_dotenv ('.does_not_exist' , verbose = True )
233238
234- mock_warning .assert_called_once_with ("File doesn't exist %s " , ".does_not_exist" )
239+ mock_info .assert_called_once_with ("Python-dotenv could not find configuration file %s. " , ".does_not_exist" )
235240
236241
237242@mock .patch .dict (os .environ , {"a" : "c" }, clear = True )
0 commit comments