Skip to content

Commit

Permalink
Force reload_dirs to be a list (#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 Nov 17, 2021
1 parent 7f824af commit 6837878
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 6837878

Please sign in to comment.