Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(822)

Unified Diff: test/make_global_settings/ar/gyptest-make_global_settings_ar.py

Issue 321183002: Use context manager to manage OS environment in tests (Closed) Base URL: http://gyp.googlecode.com/svn/trunk
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/make_global_settings/ar/gyptest-make_global_settings_ar.py
diff --git a/test/make_global_settings/ar/gyptest-make_global_settings_ar.py b/test/make_global_settings/ar/gyptest-make_global_settings_ar.py
index 7b3da341d79291f31b0c1dd28b75e0fe15360356..a62bb2d17147d49efc5ff804aa046eae64892bfb 100644
--- a/test/make_global_settings/ar/gyptest-make_global_settings_ar.py
+++ b/test/make_global_settings/ar/gyptest-make_global_settings_ar.py
@@ -101,13 +101,9 @@ if test.format == 'make':
# Test $AR and $AR_host environment variables.
-try:
- os.environ['AR'] = 'my_ar_target2'
- os.environ['AR_host'] = 'my_ar_host2'
+with TestGyp.LocalEnv({'AR': 'my_ar_target2',
+ 'AR_host': 'my_ar_host2'}):
test.run_gyp('make_global_settings_ar.gyp')
-finally:
- del os.environ['AR']
- del os.environ['AR_host']
# Ninja generator resolves $AR in gyp phase. Make generator doesn't.
if test.format == 'ninja':
if sys.platform == 'win32':
@@ -119,12 +115,9 @@ verify_ar_host(test, ar='my_ar_host2', rel_path=False)
# Test 'AR' in 'make_global_settings' with $AR_host environment variable.
-try:
- os.environ['AR_host'] = 'my_ar_host3'
+with TestGyp.LocalEnv({'AR_host': 'my_ar_host3'}):
test.run_gyp('make_global_settings_ar.gyp',
'-Dcustom_ar_target=my_ar_target3')
-finally:
- del os.environ['AR_host']
# TODO(yukawa): Support 'AR' in Ninja generator
if test.format == 'make':
verify_ar_target(test, ar='my_ar_target3', rel_path=True)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698