-
Notifications
You must be signed in to change notification settings - Fork 0
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
Migrate to hatch #431
Merged
Merged
Migrate to hatch #431
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This environment has the django-debug-toolbar installed. As part of this, I realized that ACM needs to specify the requests package as one of its dependencies; apparently google.auth does not.
Since virtual environments are defined by hatch, we don't want to set the environment variable for the service account file directly in the hatch env definition, since the file is different for every developer. Instead, modify the example project settings to read the service account file from a .env file (optionally). This requires adding the django-environ package to the dev dependencies.
Add test dependencies to the test env. Set up a python matrix that runs tests using two different versions of python. Add scripts for running all test environments vs just one test environment.
Codecov Report
@@ Coverage Diff @@
## main #431 +/- ##
=======================================
Coverage 99.82% 99.82%
=======================================
Files 121 121
Lines 22882 22882
=======================================
Hits 22843 22843
Misses 39 39 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
In pyproject.toml, set env variables in hatch environments to specify whether we are using the MySQL or sqlite3 backend in tests. Note: one test is breaking when running in MySQL; need to look into this. Also, I expect CI to fail because I have not set up the MySQL/MariaDB service in the github action workflow yet.
This will fail for a couple reasons: - no mariadb service yet - not all matrix options exist - mysql tests are failing
CI will still break for the previous reasons
One test was failing in only mysql when run with pytest, but not with unittest/manage.py test. This failure happened because the pytest settings are to reuse the database between tests; in mysql, that means that the autoincrement value for id columns is not reset between tests. Therefore, hard coding SITE_ID=2 in the tests caused the second test overriding SITE_ID to fail, since the new site created in the second test had an id of 3. Change this to setting the SITE_ID setting using a context manager to the value of the of the site that was just created instead of using the override_settings decorator. Now they pass!
This lets me set DBHOST to localhost locally, and to 127.0.0.1 in CI.
for more information, see https://pre-commit.ci
Instead of hardcoding the max failures for pytest in pyproject.toml, put it as an environment variable in the CI. This will stop CI after too many failures, but will still allow all the tests to be run locally.
This plays more nicely with the github actions for now.
Unnecessary because we're using the pre-commit.ci bot instead.
Now managed through hatch
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Use hatch for building, testing, and environment management.