diff --git a/src/dotenv/main.py b/src/dotenv/main.py index 491634d9..c33148cb 100644 --- a/src/dotenv/main.py +++ b/src/dotenv/main.py @@ -375,7 +375,7 @@ def _is_debugger(): return check_path if raise_error_if_not_found: - raise IOError("File not found") + raise FileNotFoundError("File not found") return "" diff --git a/tests/test_main.py b/tests/test_main.py index 50703af0..7f2d23cd 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -346,7 +346,7 @@ def test_find_dotenv_no_file_raise(tmp_path): leaf = prepare_file_hierarchy(tmp_path) os.chdir(leaf) - with pytest.raises(IOError): + with pytest.raises(FileNotFoundError): dotenv.find_dotenv(raise_error_if_not_found=True, usecwd=True)