mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-20 22:40:31 -04:00
remove flask-script
flask-script has been deprecated by the internal flask.cli module, but making this carries a few changes with it * you should add FLASK_APP=application.py and FLASK_DEBUG=1 to your environment.sh. * instead of using `python app.py runserver`, now you must run `flask run -p 6012`. The -p command is important - the port must be set before the config is loaded, so that it can live reload nicely. (https://github.com/pallets/flask/issues/2113#issuecomment-268014481) * find available commands by just running `flask`. * run them using flask. eg `flask list_routes` * define new tasks by giving them the decorator `@app.cli.command('task-name')`. Task name isn't needed if it's just the same as the function name. Alternatively, if app isn't available in the current scope, you can invoke the decorator directly, as seen in app/commands.py
This commit is contained in:
@@ -5,7 +5,7 @@ from unittest.mock import Mock
|
||||
|
||||
import pytest
|
||||
from notifications_python_client.errors import HTTPError
|
||||
from flask import url_for
|
||||
from flask import url_for, Flask
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
from app import create_app
|
||||
@@ -31,17 +31,16 @@ from . import (
|
||||
|
||||
@pytest.fixture(scope='session')
|
||||
def app_(request):
|
||||
app = create_app()
|
||||
app = Flask('app')
|
||||
create_app(app)
|
||||
|
||||
ctx = app.app_context()
|
||||
ctx.push()
|
||||
|
||||
def teardown():
|
||||
ctx.pop()
|
||||
|
||||
request.addfinalizer(teardown)
|
||||
app.test_client_class = TestClient
|
||||
return app
|
||||
yield app
|
||||
|
||||
ctx.pop()
|
||||
|
||||
|
||||
@pytest.fixture(scope='function')
|
||||
|
||||
Reference in New Issue
Block a user