Skip to content

Commit d71c0d4

Browse files
authored
Merge pull request #2087 from dhermes/fix-2084
Distinguishing between unset env. var. and missing file in system test.
2 parents f02d7a2 + a824bdc commit d71c0d4

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

system_tests/system_test_utils.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
ENVIRON_ERROR_MSG = """\
2929
To run the system tests, you need to set some environment variables.
3030
Please check the CONTRIBUTING guide for instructions.
31-
32-
Missing variables: %s
3331
"""
3432

3533

@@ -47,15 +45,24 @@ def create_scoped_required():
4745

4846
def check_environ():
4947
missing = []
48+
extra = ''
5049

5150
if PROJECT_ID is None:
5251
missing.append(TESTS_PROJECT)
5352

54-
if CREDENTIALS is None or not os.path.isfile(CREDENTIALS):
53+
if CREDENTIALS is None:
5554
missing.append(TEST_CREDENTIALS)
56-
57-
if missing:
58-
print(ENVIRON_ERROR_MSG % ', '.join(missing), file=sys.stderr)
55+
elif not os.path.isfile(CREDENTIALS):
56+
extra = '\nThe %s path %r is not a file.' % (TEST_CREDENTIALS,
57+
CREDENTIALS)
58+
59+
if missing or extra:
60+
msg = ENVIRON_ERROR_MSG
61+
if missing:
62+
msg += '\nMissing variables: ' + ', '.join(missing)
63+
if extra:
64+
msg += extra
65+
print(msg, file=sys.stderr)
5966
sys.exit(1)
6067

6168

0 commit comments

Comments
 (0)