Skip to content

Commit 36f6b6b

Browse files
author
Neil Grey
committed
For #34500 : Removing .format for 2.4|2.5 compatibility; Adding check for boolean variables.
1 parent 01ae5ce commit 36f6b6b

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

tests/base.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -288,12 +288,17 @@ class SgTestConfig(object):
288288
def __init__(self):
289289

290290
for key in self.config_keys():
291-
value = None
292-
if key in ['mock']:
293-
value = True
291+
294292
# Look for any environment variables that match our test
295293
# configuration naming of "SG_{KEY}". Default is None.
296-
value = os.environ.get('SG_{0}'.format(str(key).upper()))
294+
value = os.environ.get('SG_%s' % (str(key).upper()))
295+
296+
if key in ['mock']:
297+
if value == None or str(value).lower() in ['true','1']:
298+
value = True
299+
else:
300+
value = False
301+
297302
setattr(self, key, value)
298303

299304
def config_keys(self):

0 commit comments

Comments
 (0)