Skip to content
New issue

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

TestClient: EnvironBuilder cannot be passed in #2411

Closed
mitsuhiko opened this issue Jul 11, 2017 · 5 comments · Fixed by #2412
Closed

TestClient: EnvironBuilder cannot be passed in #2411

mitsuhiko opened this issue Jul 11, 2017 · 5 comments · Fixed by #2412
Labels

Comments

@mitsuhiko
Copy link
Contributor

In a normal test client from werkzeug you can pass the environment builder in. With Flask that is currently not possible. In some situations people might want to interface with the builder directly.

@davidism
Copy link
Member

I'm assuming you mean passing an EnvironBuilder to FlaskClient.open?

@pachewise
Copy link

would FlaskClient.open simply use the EnvironBuilder passed in (without the defaults in make_test_environ_builder)?

@mitsuhiko
Copy link
Contributor Author

@davidism yeah. or at least have an option to play with the builder before its being used to create the environment.

@davidism
Copy link
Member

davidism commented Jul 12, 2017

What happens if they've overridden client.environ_base? Does that get ignored? Or ignored for for EnvironBuilder but not dict instances?

How should environ.environ_overrides['flask._preserve_context'] be handled? It's required for keeping the behavior of the test client, but setting it would mutate the passed environ.

@mitsuhiko
Copy link
Contributor Author

A crude way could be to pass in a function that is called with the builder so you can modify it before open takes place.

davidism added a commit that referenced this issue Jul 13, 2017
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants