Permalink
Browse files

Merge pull request #83 from lepture/access-app

Access app
  • Loading branch information...
2 parents e0cf38d + 2c242b2 commit a022a264273c3c0e4c763097185662ed43549f11 @techniq techniq committed Dec 20, 2013
Showing with 4 additions and 21 deletions.
  1. +4 −2 flask_script/__init__.py
  2. +0 −19 tests.py
View
6 flask_script/__init__.py
@@ -11,8 +11,8 @@
from flask import Flask
-from ._compat import text_type, iteritems, imap, izip
-from .commands import Group, Option, InvalidCommand, Command, Server, Shell
+from ._compat import text_type, iteritems, izip
+from .commands import Group, Option, Command, Server, Shell
from .cli import prompt, prompt_pass, prompt_bool, prompt_choices
__all__ = ["Command", "Shell", "Server", "Manager", "Group", "Option",
@@ -380,6 +380,8 @@ def handle(self, prog, args=None):
positional_args = []
app = self.create_app(**app_config)
+ # for convience usage in a command
+ self.app = app
return handle(app, *positional_args, **kwargs)
View
19 tests.py
@@ -413,25 +413,6 @@ def create_app(config_name='Empty'):
assert 'Development' in out
assert 'OK' in out
- code = run('manage.py -c Before simple', lambda: manager.run())
- out, err = capsys.readouterr()
- assert code == 0
- assert 'Before' in out
- assert 'OK' in out
-
- code = run('manage.py simple -c After', lambda: manager.run())
- out, err = capsys.readouterr()
- assert code == 0
- assert 'After' in out
- assert 'OK' in out
-
- code = run('manage.py -c DoNotShow simple -c NewValue', lambda: manager.run())
- out, err = capsys.readouterr()
- assert code == 0
- assert 'DoNotShow' not in out # first parameter is ignored
- assert 'NewValue' in out # second on is printed
- assert 'OK' in out
-
def test_get_usage(self):
manager = Manager(self.app)

0 comments on commit a022a26

Please sign in to comment.