Skip to content

Commit

Permalink
tweak runserver when using --root (#211)
Browse files Browse the repository at this point in the history
* tweak runserver when using --root

* uprev, assert message

* tweak _find_app_path for backwards compatibility

* fix tests
  • Loading branch information
samuelcolvin authored Nov 19, 2018
1 parent 505dc2f commit cff6db0
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
5 changes: 5 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
History
-------

0.10.4 (2018-11-18)
-------------------
* fix conflict with click checks that prevented the ``--root`` flag working properly, #206
* uprev dependencies

0.10.3 (2018-09-25)
-------------------
* remove ``loop`` argument from ``run_app()``, #206
Expand Down
5 changes: 4 additions & 1 deletion aiohttp_devtools/runserver/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,15 @@ def static_path_str(self):
return self.static_path and str(self.static_path)

def _find_app_path(self, app_path: str) -> Path:
# for backwards compatibility try this first
path = (self.root_path / app_path).resolve()
if not path.exists():
path = Path(app_path).resolve()
if path.is_file():
logger.debug('app_path is a file, returning it directly')
return path

assert path.is_dir()
assert path.is_dir(), 'app_path {} is not a directory'.format(path)
files = [x for x in path.iterdir() if x.is_file()]
for std_file_name in STD_FILE_NAMES:
try:
Expand Down
2 changes: 1 addition & 1 deletion aiohttp_devtools/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

__all__ = ['VERSION']

VERSION = StrictVersion('0.10.3')
VERSION = StrictVersion('0.10.4')
4 changes: 2 additions & 2 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def test_serve_no_args():
runner = CliRunner()
result = runner.invoke(cli, ['serve'])
assert result.exit_code == 2
assert 'Error: Missing argument "path"' in result.output
assert 'error: missing argument "path"' in result.output.lower()


def test_runserver(mocker):
Expand Down Expand Up @@ -131,7 +131,7 @@ def test_start_no_args():
runner = CliRunner()
result = runner.invoke(cli, ['start'])
assert result.exit_code == 2
assert 'Error: Missing argument "path"' in result.output
assert 'error: missing argument "path"' in result.output.lower()


def test_start_help():
Expand Down

0 comments on commit cff6db0

Please sign in to comment.