Skip to content

Commit fb59514

Browse files
committed
Merge pull request #849 from tseaver/squelch-project_id
For consistency, replace all use of `project_id` w/ `project`.
2 parents d21bc3f + bede80f commit fb59514

5 files changed

Lines changed: 11 additions & 16 deletions

File tree

docs/pubsub-usage.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Connection / Authorization
88

99
- credentials (derived from GAE / GCE environ if present).
1010

11-
- ``project_id`` (derived from GAE / GCE environ if present).
11+
- ``project`` (derived from GAE / GCE environ if present).
1212

1313
- ``scopes``
1414

@@ -29,7 +29,7 @@ Create a new topic for an explicit project:
2929
.. doctest::
3030

3131
>>> from gcloud.pubsub import Topic
32-
>>> topic = Topic('topic_name', project_id='my.project')
32+
>>> topic = Topic('topic_name', project='my.project')
3333
>>> topic.create() # API request
3434

3535
Check for the existance of a topic:
@@ -54,7 +54,7 @@ List topics for an explicit project:
5454
.. doctest::
5555

5656
>>> from gcloud.pubsub import list_topics
57-
>>> topics = list_topics(project_id='my.project') # API request
57+
>>> topics = list_topics(project='my.project') # API request
5858
>>> [topic.name for topic in topics]
5959
['topic_name']
6060

gcloud/test__helpers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -340,13 +340,13 @@ def close(self):
340340

341341
class _HTTPConnection(_BaseHTTPConnection):
342342

343-
def __init__(self, status, project_id):
343+
def __init__(self, status, project):
344344
super(_HTTPConnection, self).__init__()
345345
self.status = status
346-
self.project_id = project_id
346+
self.project = project
347347

348348
def getresponse(self):
349-
return _HTTPResponse(self.status, self.project_id)
349+
return _HTTPResponse(self.status, self.project)
350350

351351

352352
class _TimeoutHTTPConnection(_BaseHTTPConnection):

regression/pubsub.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ def test_list_topics(self):
5757

5858
# Retrieve the topics.
5959
all_topics, _ = pubsub.list_topics()
60-
project_id = pubsub.get_default_project()
60+
project = pubsub.get_default_project()
6161
created = [topic for topic in all_topics
6262
if topic.name in topics_to_create and
63-
topic.project == project_id]
63+
topic.project == project]
6464
self.assertEqual(len(created), len(topics_to_create))
6565

6666
def test_create_subscription(self):

regression/regression_utils.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"""
2929

3030

31-
def get_environ(require_datastore=False, require_storage=False):
31+
def check_environ(require_datastore=False, require_storage=False):
3232
if require_datastore:
3333
if DATASET_ID is None or not os.path.isfile(CREDENTIALS):
3434
print(ENVIRON_ERROR_MSG, file=sys.stderr)
@@ -38,8 +38,3 @@ def get_environ(require_datastore=False, require_storage=False):
3838
if PROJECT_ID is None or not os.path.isfile(CREDENTIALS):
3939
print(ENVIRON_ERROR_MSG, file=sys.stderr)
4040
sys.exit(1)
41-
42-
return {
43-
'project_id': PROJECT_ID,
44-
'dataset_id': DATASET_ID,
45-
}

regression/run_regression.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ def main():
4242
args = parser.parse_args()
4343
# Make sure environ is set before running test.
4444
if args.package == 'datastore':
45-
regression_utils.get_environ(require_datastore=True)
45+
regression_utils.check_environ(require_datastore=True)
4646
elif args.package == 'storage':
47-
regression_utils.get_environ(require_storage=True)
47+
regression_utils.check_environ(require_storage=True)
4848
test_result = run_module_tests(args.package)
4949
if not test_result.wasSuccessful():
5050
sys.exit(1)

0 commit comments

Comments
 (0)