Modernize a bunch of things #157
Open
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.
In the first commit:
setting_changedsignal to connect and disconnect theadd_default_sitesignal handler during testspathlib.Path, since that API is much nicer than theos.pathAPI, which let me simplify some file writing and reading later on, since we can usePath.read_text()andPath.write_text()instead of manually using context managers to open files for reading and writing.assertInandassertQuerySetEqual.override_settingdecorator andself.settings()context manager to automatically handle changing settings during tests, and resetting to the previous values after those tests finish.In the second commit:
TestCases according to what piece of dbtemplates they test.test_settings.pyto fit more modern Django settings modules (read: useCACHESinstead of configuring a cache backend directly).Template.populate()method a little bit to improve readability by using try/except/else.pathlib.Pathin thesync_templatescommand.dbtemplates/utils/templates.pyto properly record the chain of loaders that were tried when finding a template.Then I formatted a bunch of files with Ruff.
Once this is merged I'll submit a commit/PR that updates the changelog and then merge and tag it so a new version gets released to PyPI.