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

Side by Side Diff: test/lib/TestGyp.py

Issue 324893007: Override the user's language settings during tests Base URL: https://chromium.googlesource.com/external/gyp.git@master
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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 Google Inc. All rights reserved. 1 # Copyright (c) 2012 Google Inc. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """ 5 """
6 TestGyp.py: a testing framework for GYP integration tests. 6 TestGyp.py: a testing framework for GYP integration tests.
7 """ 7 """
8 8
9 import collections 9 import collections
10 from contextlib import contextmanager 10 from contextlib import contextmanager
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 self.copy_test_configuration(self.origin_cwd, self.workdir) 144 self.copy_test_configuration(self.origin_cwd, self.workdir)
145 self.set_configuration(None) 145 self.set_configuration(None)
146 146
147 # Set $HOME so that gyp doesn't read the user's actual 147 # Set $HOME so that gyp doesn't read the user's actual
148 # ~/.gyp/include.gypi file, which may contain variables 148 # ~/.gyp/include.gypi file, which may contain variables
149 # and other settings that would change the output. 149 # and other settings that would change the output.
150 os.environ['HOME'] = self.workpath() 150 os.environ['HOME'] = self.workpath()
151 # Clear $GYP_DEFINES for the same reason. 151 # Clear $GYP_DEFINES for the same reason.
152 if 'GYP_DEFINES' in os.environ: 152 if 'GYP_DEFINES' in os.environ:
153 del os.environ['GYP_DEFINES'] 153 del os.environ['GYP_DEFINES']
154 # Override the user's language settings, which could
155 # otherwise make the output vary from what is expected.
156 os.environ['LC_ALL'] = 'C'
154 157
155 def built_file_must_exist(self, name, type=None, **kw): 158 def built_file_must_exist(self, name, type=None, **kw):
156 """ 159 """
157 Fails the test if the specified built file name does not exist. 160 Fails the test if the specified built file name does not exist.
158 """ 161 """
159 return self.must_exist(self.built_file_path(name, type, **kw)) 162 return self.must_exist(self.built_file_path(name, type, **kw))
160 163
161 def built_file_must_not_exist(self, name, type=None, **kw): 164 def built_file_must_not_exist(self, name, type=None, **kw):
162 """ 165 """
163 Fails the test if the specified built file name exists. 166 Fails the test if the specified built file name exists.
(...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after
1220 1223
1221 def TestGyp(*args, **kw): 1224 def TestGyp(*args, **kw):
1222 """ 1225 """
1223 Returns an appropriate TestGyp* instance for a specified GYP format. 1226 Returns an appropriate TestGyp* instance for a specified GYP format.
1224 """ 1227 """
1225 format = kw.pop('format', os.environ.get('TESTGYP_FORMAT')) 1228 format = kw.pop('format', os.environ.get('TESTGYP_FORMAT'))
1226 for format_class in format_class_list: 1229 for format_class in format_class_list:
1227 if format == format_class.format: 1230 if format == format_class.format:
1228 return format_class(*args, **kw) 1231 return format_class(*args, **kw)
1229 raise Exception, "unknown format %r" % format 1232 raise Exception, "unknown format %r" % format
OLDNEW
« 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