refactor: clean up code to py39+ supported syntax
- f-strings instead of format
- latest typing support instead of pre 3.9 TitleCase
- remove UTF-8 declarations.
- many more changes
Powered by https://github.com/asottile/pyupgrade/ + manual cleanups
- wrap setup fixtures in savepoint
- wrap scheduled_job_type in savepoint
- ignore duplicates where it's ignored by exc
- dont attempt to delete from deleted table
- delete custom field and commit - stale meta causes future inserts to
insert unknown field.
Reason for unsetting flags in setUp:
1. frappe.flags.whatever is reset in each request...since it's a werzeug local (ref: https://werkzeug.palletsprojects.com/en/1.0.x/local/)
2. so until it is in the context of current request, it has the same value
3. when you call rename_doc via a request, it's flags are forgotten post that
4. but in a test suite, the whole module's tests run in a single process and the flags aren't (un|re)set
5. which is why frappe.flags.whatever has the same value throughout this module's tests