Re: [infra-tests] use context manager instead of prerun script (#5771)

Reviewed 2 of 2 files at r2.
Review status: all files reviewed at latest revision, 3 unresolved discussions, some commit checks failed.

---

*[tools/wptrunner/wptrunner/browsers/sauce.py, line 169 at r2](https://reviewable.io:443/reviews/w3c/web-platform-tests/5771#-KjITF5gLqXtAFay_1PK:-KjITF5gLqXtAFay_1PL:b-p1nl73) ([raw file](https://github.com/w3c/web-platform-tests/blob/6ecdaa1c05a81233bdf08aabc935f9f51c61100b/tools/wptrunner/wptrunner/browsers/sauce.py#L169)):*
> ```Python
>         self.sc_process.terminate()
>         try:
>             os.remove(glob.glob(os.path.join(temp_path, "sc-*-linux")))
> ```

`temp_path` seems to be undefined here always. Using `try/except` isn't great; it's better to check if the dir was actually created and then try to delete it (with `try/except` just catching the `OSError` for the directory not exisitng anymore.

---


*Comments from [Reviewable](https://reviewable.io:443/reviews/w3c/web-platform-tests/5771)*
<!-- Sent from Reviewable.io -->


View on GitHub: https://github.com/w3c/web-platform-tests/pull/5771#issuecomment-299173566

Received on Thursday, 4 May 2017 12:41:18 UTC