Use context manager to manage OS environment in tests

This is a follow up CL for gyp r1931, just for the code cleanup.  Inspired by Nico's gyp r1893.

BUG=gyp:434
TEST=unittest
R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/321183002

git-svn-id: http://gyp.googlecode.com/svn/trunk@1934 78cadc50-ecff-11dd-a971-7dbc132099af
1 file changed