We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I'm attempting to write some tests around telemetry of a flask app using pytest asserting on the contents of stdout. Suppose I have this app,
imports ... app = Flask(__name__) @app.route("/") def hello(): return "hello" @app.before_first_request def app_start(): app.logger.addHandler(logging.StreamHandler(sys.stdout)) app.logger.setLevel(logging.INFO) @app.after_request def after_request(response): app.logger.info('signal')
and this test
imports ... __flask__ = app.test_client() __flask__.testing = True def test_endpoint_produces_signal(capsys): __flask__.get('/') out, err = capsys.readouterr() assert out == 'signal'
Unfortunately this test fails. However, if I move the logging configuration and info call all to after_request is works. Thanks for your help.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I'm attempting to write some tests around telemetry of a flask app using pytest asserting on the contents of stdout. Suppose I have this app,
and this test
Unfortunately this test fails. However, if I move the logging configuration and info call all to after_request is works. Thanks for your help.
The text was updated successfully, but these errors were encountered: