• 
      

    Update make_tempfile and fix TestCase.precreate_tempfiles with content.

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

    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.

    Summary ID
    Update make_tempfile and fix TestCase.precreate_tempfiles with content.
    `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.
    b8c2d80b06cff0d3d0e867884d0f3b5cc2cbe404
    david
    1. Ship It!
    2. 
        
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-4.x (3c39f6c)