Skip to content

Commit

Permalink
Force reload_dirs to be a list (encode#978)
Browse files Browse the repository at this point in the history
* Add failing test

* Force reload_dirs to be a list

* Lint
  • Loading branch information
euri10 authored and Kludex committed Oct 29, 2022
1 parent 2eb8644 commit 25a6f9a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ def test_config_should_reload_is_set(app, expected_should_reload):
assert config_reload.should_reload is expected_should_reload


def test_reload_dir_is_set():
config = Config(app=asgi_app, reload=True, reload_dirs="reload_me")
assert config.reload_dirs == ["reload_me"]


def test_wsgi_app():
config = Config(app=wsgi_app, interface="wsgi", proxy_headers=False)
config.load()
Expand Down
5 changes: 4 additions & 1 deletion uvicorn/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,10 @@ def __init__(
if reload_dirs is None:
self.reload_dirs = [os.getcwd()]
else:
self.reload_dirs = reload_dirs
if isinstance(reload_dirs, str):
self.reload_dirs = [reload_dirs]
else:
self.reload_dirs = reload_dirs

if env_file is not None:
from dotenv import load_dotenv
Expand Down

0 comments on commit 25a6f9a

Please sign in to comment.