Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix IO Permissions on Appveyor. #1868

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions gcloud/test__helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,15 @@ def tearDown(self):

def test_success(self):
import os
import tempfile
with tempfile.NamedTemporaryFile(mode='w') as credential_file:
credential_file.write('{"project_id": "test-project-id"}')
credential_file.seek(0)
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = credential_file.name
from gcloud._testing import _NamedTemporaryFile

self.assertEqual('test-project-id', self._callFUT())
with _NamedTemporaryFile() as temp:
with open(temp.name, mode='w') as creds_file:
creds_file.write('{"project_id": "test-project-id"}')
creds_file.seek(0)
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = creds_file.name

self.assertEqual('test-project-id', self._callFUT())

def test_no_environment(self):
self.assertEqual(None, self._callFUT())
Expand All @@ -184,9 +186,11 @@ class Test__get_default_service_project_id(unittest2.TestCase):
config_file = 'config_default'

def setUp(self):
import tempfile
import os
self.temp_config_path = tempfile.gettempdir()
from gcloud._testing import _NamedTemporaryFile

with _NamedTemporaryFile() as temp:
self.temp_config_path = os.path.dirname(temp.name)

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

conf_path = os.path.join(self.temp_config_path, self.config_path)
os.makedirs(conf_path)
Expand Down