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

Refactor settings and run pytest CI in Docker container #3316

Closed
wants to merge 3 commits into from

Conversation

Minnozz
Copy link
Contributor

@Minnozz Minnozz commented Mar 11, 2024

Pytest should not use the local .env file, even if it is present.

This uses multiple compose files and some environment variables and command line flags to use either .env or .env.example + .env.ci.

Pytest failures should now also appear as annotations on PRs.

Fixes #3308

@Minnozz Minnozz marked this pull request as draft March 11, 2024 15:44
@Minnozz Minnozz force-pushed the refactor-settings branch 3 times, most recently from 1136acc to d1a7bf0 Compare March 11, 2024 17:07
@Minnozz Minnozz marked this pull request as ready for review March 11, 2024 17:18
Docker already puts the contents of .env in the environment.
Use `.env.example` and `.env.ci` as the environment, instead of `.env`.
@Minnozz
Copy link
Contributor Author

Minnozz commented Mar 11, 2024

Alternative to #3315 (only one is needed)

@dato
Copy link
Contributor

dato commented Mar 12, 2024

Hello! And thanks for paying attention to this part of the development setup.

Pytest failures should now also appear as annotations on PRs.

This sounds cool (if it does what I think it does!).

Feel free to merge #3315 instead and close #3316.

Ah, yes, like Hugh, I would also favor going with #3315 for the time being.

072bd3f Don't read .env from within Python

This is a breaking change for non-Docker setups (which don't use EnvironmentFile by default), and any developer who runs pytest or gunicorn directly (they would need to add something like direnv to their setup, I guess?).

This doesn't mean it can't be done, but it introduces churn, plus we'd need updates in documentation and .service files.

As mentioned above, I would suggest we go with #3315 for now (and the use of pytest-github-actions-annotate-failures, if it's easy to introduce on the current version of the workflows?).

@Minnozz
Copy link
Contributor Author

Minnozz commented Mar 12, 2024

I'll close #3316 and re-introduce the pytest PR annotations in a separate PR.

@Minnozz Minnozz closed this Mar 12, 2024
@Minnozz
Copy link
Contributor Author

Minnozz commented Mar 13, 2024

I re-did this PR in #3318

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.

pytest failure because it uses ALLOWED_HOSTS from development .env
2 participants