Skip to content
Myr

fixed unmatched elif

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Also update relevant test

authored by Josiah Philipsen · committed by Markus Unterwaditzer · parent f91aea2 · Browse files · 2 files+11 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+11 added−4 removed

  • tests:+8 added−1 removed
  • other:+3 added−3 removed

2 files+11 added−4 removed

modified:flask/cli.py+3 added-3 removed
53 unmodified lines
54 """55 module = []5657 # Chop off file extensions or package markers58 if filename.endswith('.py'):59 filename = filename[:-3]60 elif os.path.split(filename)[1] == '__init__.py':58 if os.path.split(filename)[1] == '__init__.py':59 filename = os.path.dirname(filename)60 elif filename.endswith('.py'):61 filename = filename[:-3]62 else:63 raise NoAppException('The file provided (%s) does exist but is not a '64 'valid Python file. This means that it cannot '65 'be used as application. Please change the '
417 unmodified lines
modified:tests/test_cli.py+8 added-1 removed
17 unmodified lines
18from click.testing import CliRunner19from flask import Flask, current_app2021from flask.cli import AppGroup, FlaskGroup, NoAppException, ScriptInfo, \22 find_best_app, locate_app, with_appcontext22 find_best_app, locate_app, with_appcontext, prepare_exec_for_file232425def test_cli_name(test_apps):26 """Make sure the CLI object's name is the app's name and not the app itself"""
21 unmodified lines
4849 pytest.raises(NoAppException, find_best_app, mod)505152def test_prepare_exec_for_file(test_apps):53 assert prepare_exec_for_file('test.py') == 'test'54 assert prepare_exec_for_file('/usr/share/__init__.py') == 'share'55 with pytest.raises(NoAppException):56 prepare_exec_for_file('test.txt')575859def test_locate_app(test_apps):60 """Test of locate_app."""61 assert locate_app("cliapp.app").name == "testapp"62 assert locate_app("cliapp.app:testapp").name == "testapp"
81 unmodified lines