Index: test/cxxflags/gyptest-cxxflags.py |
diff --git a/test/cxxflags/gyptest-cxxflags.py b/test/cxxflags/gyptest-cxxflags.py |
index 70142e7cedadcac595b239e1b889c4aa3865a20b..e0daea2126a9aa1d52546bef69d435ac6b318029 100755 |
--- a/test/cxxflags/gyptest-cxxflags.py |
+++ b/test/cxxflags/gyptest-cxxflags.py |
@@ -12,29 +12,15 @@ the use of the environment during regeneration when the gyp file changes. |
import os |
import TestGyp |
-env_stack = [] |
- |
- |
-def PushEnv(): |
- env_copy = os.environ.copy() |
- env_stack.append(env_copy) |
- |
-def PopEnv(): |
- os.eniron=env_stack.pop() |
Nils Barth (inactive)
2014/04/08 08:56:32
Ow, notice the typos?
os.eniron (not os.en*v*iron)
|
# Regenerating build files when a gyp file changes is currently only supported |
# by the make generator. |
test = TestGyp.TestGyp(formats=['make']) |
-try: |
- PushEnv() |
- os.environ['CXXFLAGS'] = '-O0' |
+# We reset the environ after calling gyp. When the auto-regeneration happens, |
+# the same define should be reused anyway. |
+with TestGyp.LocalEnv({'CXXFLAGS': '-O0'}): |
test.run_gyp('cxxflags.gyp') |
-finally: |
- # We clear the environ after calling gyp. When the auto-regeneration happens, |
- # the same define should be reused anyway. Reset to empty string first in |
- # case the platform doesn't support unsetenv. |
- PopEnv() |
test.build('cxxflags.gyp') |
@@ -45,15 +31,8 @@ test.run_built_executable('cxxflags', stdout=expect) |
test.sleep() |
-try: |
- PushEnv() |
- os.environ['CXXFLAGS'] = '-O2' |
+with TestGyp.LocalEnv({'CXXFLAGS': '-O2'}): |
test.run_gyp('cxxflags.gyp') |
-finally: |
- # We clear the environ after calling gyp. When the auto-regeneration happens, |
- # the same define should be reused anyway. Reset to empty string first in |
- # case the platform doesn't support unsetenv. |
- PopEnv() |
test.build('cxxflags.gyp') |