Skip to content

Let Flask manage its own request contexts #108

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

Merged
merged 2 commits into from
Sep 10, 2017
Merged

Conversation

jcomo
Copy link
Collaborator

@jcomo jcomo commented Apr 8, 2017

Don't manage the context stack in the test setup / teardown. Instead, let Flask handle it. This fixes the issue where global and request context was being reused on subsequent test client requests within the same test case.

I'm a bit concerned that there are some people relying on the fact that the context exists in the setup method for things like attaching global context. While its not a good practice, I wouldn't want to break others test suites with this change.

Fixes #105

@jcomo jcomo force-pushed the fix/request-contexts branch from bcbfd99 to 3bf7473 Compare April 8, 2017 21:52
@jeanphix
Copy link

👍

@jcomo jcomo merged commit 624c647 into master Sep 10, 2017
@jcomo jcomo deleted the fix/request-contexts branch September 10, 2017 02:32
@Mego Mego mentioned this pull request Dec 18, 2017
jcox-dev pushed a commit to ONSdigital/ras-party that referenced this pull request Dec 19, 2017
jcox-dev pushed a commit to ONSdigital/ras-party that referenced this pull request Dec 19, 2017
Remove dependency on ras-common-utils

* Use config objects and environment variables over yaml
* Simplify public website URL builder
* Stop passing config object around helper functions
* Tidying up string formatting
* Use config object for alembic migrations
* Add cfenv to inject Cloudfoundry service dependency config variables
* Pin flask-testing to pre 0.7.0 to work-around missing app context

jarus/flask-testing#108
@jcomo jcomo mentioned this pull request Dec 19, 2017
jcomo pushed a commit that referenced this pull request Dec 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Context not being reset between requests
2 participants