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

Migrate to hatch #431

Merged
merged 47 commits into from
Nov 3, 2023
Merged

Migrate to hatch #431

merged 47 commits into from
Nov 3, 2023

Conversation

amstilp
Copy link
Contributor

@amstilp amstilp commented Nov 1, 2023

Use hatch for building, testing, and environment management.

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.
Copy link

codecov bot commented Nov 1, 2023

Codecov Report

Merging #431 (8d523ab) into main (626ef34) will not change coverage.
The diff coverage is n/a.

❗ Current head 8d523ab differs from pull request most recent head 9a0c921. Consider uploading reports for the commit 9a0c921 to get more accurate results

@@           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

amstilp and others added 20 commits November 1, 2023 15:07
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.
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.
@amstilp amstilp merged commit 9c67840 into main Nov 3, 2023
18 checks passed
@amstilp amstilp deleted the maint/use-hatch branch November 3, 2023 22:12
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.

1 participant