Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ci] Correct file management in tests #18341

Merged
merged 1 commit into from Aug 16, 2019

Conversation

@jugglinmike
Copy link
Contributor

jugglinmike commented Aug 8, 2019

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.

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
@jugglinmike jugglinmike requested a review from gsnedders Aug 8, 2019
@wpt-pr-bot wpt-pr-bot requested a review from jgraham Aug 8, 2019
@jugglinmike jugglinmike merged commit 7f35d6c into web-platform-tests:master Aug 16, 2019
17 checks passed
17 checks passed
Azure Pipelines Build #20190808.94 succeeded
Details
Azure Pipelines (./wpt test-jobs) ./wpt test-jobs succeeded
Details
Azure Pipelines (affected tests without changes: Safari Technology Preview) affected tests without changes: Safari Technology Preview succeeded
Details
Azure Pipelines (affected tests: Safari Technology Preview) affected tests: Safari Technology Preview succeeded
Details
Azure Pipelines (infrastructure/ tests: macOS) infrastructure/ tests: macOS succeeded
Details
Azure Pipelines (tools/ unittests: Windows Python 3) tools/ unittests: Windows Python 3 succeeded
Details
Azure Pipelines (tools/ unittests: Windows) tools/ unittests: Windows succeeded
Details
Azure Pipelines (tools/ unittests: macOS) tools/ unittests: macOS succeeded
Details
Azure Pipelines (tools/wpt/ tests: Windows) tools/wpt/ tests: Windows succeeded
Details
Azure Pipelines (tools/wpt/ tests: macOS) tools/wpt/ tests: macOS succeeded
Details
Azure Pipelines (tools/wptrunner/ unittests: Windows) tools/wptrunner/ unittests: Windows succeeded
Details
Azure Pipelines (tools/wptrunner/ unittests: macOS) tools/wptrunner/ unittests: macOS succeeded
Details
Azure Pipelines (wpt.fyi hook: safari-preview-affected-tests) wpt.fyi hook: safari-preview-affected-tests succeeded
Details
Azure Pipelines (wpt.fyi hook: safari-preview-affected-tests-without-changes) wpt.fyi hook: safari-preview-affected-tests-without-changes succeeded
Details
Taskcluster (pull_request) TaskGroup: success
Details
staging.wpt.fyi - safari[experimental] Safari results
Details
wpt.fyi - safari[experimental] Safari results
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

5 participants
You can’t perform that action at this time.