From 02ad33d2c6f337b13093a5e551c940404ca29728 Mon Sep 17 00:00:00 2001 From: Barret Schloerke Date: Fri, 28 Mar 2025 15:41:00 -0400 Subject: [PATCH 1/2] Use relative reload excludes dir values --- tests/supervisors/test_reload.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/supervisors/test_reload.py b/tests/supervisors/test_reload.py index bd40e7230..85fbb6aa1 100644 --- a/tests/supervisors/test_reload.py +++ b/tests/supervisors/test_reload.py @@ -129,7 +129,7 @@ def test_should_not_reload_when_python_file_in_excluded_subdir_is_changed(self, config = Config( app="tests.test_config:asgi_app", reload=True, - reload_excludes=[str(sub_dir)], + reload_excludes=[str(sub_dir.relative_to(self.reload_path))], # make it relative to current working dir ) reloader = self._setup_reloader(config) @@ -284,7 +284,7 @@ def test_watchfiles_no_changes(self) -> None: config = Config( app="tests.test_config:asgi_app", reload=True, - reload_excludes=[str(sub_dir)], + reload_excludes=[str(sub_dir.relative_to(self.reload_path))], # make it relative to current working dir ) reloader = self._setup_reloader(config) From 16117eed504376978c7367ef05e7936a0c5b980c Mon Sep 17 00:00:00 2001 From: Barret Schloerke Date: Fri, 28 Mar 2025 15:41:14 -0400 Subject: [PATCH 2/2] Fix broken path value --- uvicorn/supervisors/watchfilesreload.py | 1 + 1 file changed, 1 insertion(+) diff --git a/uvicorn/supervisors/watchfilesreload.py b/uvicorn/supervisors/watchfilesreload.py index 0d3b9b77e..a45d4bb8a 100644 --- a/uvicorn/supervisors/watchfilesreload.py +++ b/uvicorn/supervisors/watchfilesreload.py @@ -23,6 +23,7 @@ def __init__(self, config: Config): for e in config.reload_excludes: p = Path(e) try: + p = p.resolve() is_dir = p.is_dir() except OSError: # pragma: no cover # gets raised on Windows for values like "*.py"