Skip to content

Use a factory to create the app object #3446

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
Jul 7, 2025

Conversation

jcristau
Copy link
Contributor

@jcristau jcristau commented Jul 4, 2025

Instead of creating the flask/connexion app at import time, do it when create_app() is called. This makes it easier for different tests to use a different app object with different config, especially with the port to connexion 3, where some config settings aren't meant to be changed after the app has started being used.

@jcristau jcristau force-pushed the app-factory branch 2 times, most recently from e75fbd3 to ad53501 Compare July 4, 2025 13:43
@jcristau jcristau changed the title use a factory to create the app object Use a factory to create the app object Jul 4, 2025
@jcristau jcristau marked this pull request as ready for review July 4, 2025 13:56
@jcristau jcristau requested a review from a team as a code owner July 4, 2025 13:56
Copy link
Contributor

@bhearsum bhearsum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mostly reviewed this by looking at the diff with whitespace hidden, which makes it pretty clear there's virtually no change in the non-test code, which is what I would expect.

I assume you've run docker compose locally to make sure the .wsgi parts still work?

jcristau added 2 commits July 4, 2025 18:22
This lets us create an app when needed instead of at import time.
@jcristau
Copy link
Contributor Author

jcristau commented Jul 4, 2025

I assume you've run docker compose locally to make sure the .wsgi parts still work?

cough I have now.

@jcristau jcristau merged commit eb82933 into mozilla-releng:main Jul 7, 2025
9 checks passed
@jcristau jcristau deleted the app-factory branch July 7, 2025 09:20
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.

2 participants