Closed Bug 1574533 Opened 5 months ago Closed 5 months ago

[wpt-sync] Sync PR 18341 - [ci] Correct file management in tests

Categories

(Testing :: web-platform-tests, task, P4)

task

Tracking

(firefox70 fixed)

RESOLVED FIXED
mozilla70
Tracking Status
firefox70 --- fixed

People

(Reporter: wptsync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 18341 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/18341
Details from upstream follow.

Mike Pennisi <mike@mikepennisi.com> wrote:

[ci] Correct file management in tests

The mkstemp function creates a file and opens that file [1], so these
tests erroneously attempted to delete an open file. This mistake was not
identified during development or automated testing because it only leads
to a runtime exception in Windows environments [2].

Refactor the helper function to close the file immediately after writing
to it.

[1] > mkstemp() returns a tuple containing an OS-level handle to an
> open file (as would be returned by os.open()) and the absolute
> pathname of that file, in that order.

 https://docs.python.org/2/library/tempfile.html#tempfile.mkstemp

[2] > On Windows, attempting to remove a file that is in use causes an
> exception to be raised; on Unix, the directory entry is removed
> but the storage allocated to the file is not made available until
> the original file is no longer in use.

 https://docs.python.org/2/library/os.html#os.remove

This resolves gh-18255.

Whiteboard: [wptsync downstream] → [wptsync downstream error]
Whiteboard: [wptsync downstream error] → [wptsync downstream]
Whiteboard: [wptsync downstream] → [wptsync downstream error]
Whiteboard: [wptsync downstream error] → [wptsync downstream]
The PR was not expected to affect any tests, but the try push wasn't a success. Check the try results for infrastructure issues
Result changes from PR not available.
Pushed by wptsync@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/d8ec210f26bd
[wpt PR 18341] - [ci] Correct file management in tests, a=testonly
Status: NEW → RESOLVED
Closed: 5 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla70
You need to log in before you can comment on or make changes to this bug.