Skip to content
Myr

Enhance tests.test_cli.test_find_best_app (#1882)

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

This commit adds a test case for `test_find_best_app` where Module object does not contain Flask application. Also cleans the function little bit to provides more meaningful comment.

authored by Hyunchel Kim · committed by David Lord · parent b7a0cc6 · Browse files · 1 file+14 added−11 removed
This commit

State

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

Diff stats

1 file+14 added−11 removed

  • tests:+14 added−11 removed

1 file+14 added−11 removed

modified:tests/test_cli.py+14 added-11 removed
30 unmodified lines
31 assert testapp.cli.name == testapp.name323334def test_find_best_app(test_apps):35 """Test of find_best_app."""36 class mod:35 """Test if `find_best_app` behaves as expected with different combinations of input."""36 class Module:37 app = Flask('appname')38 assert find_best_app(mod) == mod.app38 assert find_best_app(Module) == Module.app3940 class mod:40 class Module:41 application = Flask('appname')42 assert find_best_app(mod) == mod.application42 assert find_best_app(Module) == Module.application4344 class mod:44 class Module:45 myapp = Flask('appname')46 assert find_best_app(mod) == mod.myapp46 assert find_best_app(Module) == Module.myapp4748 class mod:49 myapp = Flask('appname')48 class Module:49 pass50 pytest.raises(NoAppException, find_best_app, Module)5152 class Module:53 myapp1 = Flask('appname1')54 myapp2 = Flask('appname2')55 pytest.raises(NoAppException, find_best_app, Module)5652 pytest.raises(NoAppException, find_best_app, mod)575458def test_prepare_exec_for_file(test_apps):59 """Expect the correct path to be set and the correct module name to be returned.6061 :func:`prepare_exec_for_file` has a side effect, where
114 unmodified lines