Update make_tempfile and fix TestCase.precreate_tempfiles with content.

Review Request #12567 — Created Aug. 24, 2022 and submitted — Latest diff uploaded

Information

RBTools
release-4.x

Reviewers

make_tempfile() supports a content= parameter to specify content
going into the temp file without having to do a follow-up write.
However, TestCase.precreate_tempfiles() completely ignored this,
pre-creating the files but never writing the content to them when
handling the spy for make_tempfile().

This has been updated to perform the write when called, if content is
provided.

It also updates make_tempfile() for type safety and to require keyword
arguments (deprecating positional arguments), to help ensure signatures
stay consistent.

Unit tests pass on Python 3.7-3.11.

Commits

Files