-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Bigtable: create snippets.py for python docs. #6012
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to add support for testing the snippets. See bigquery/nox.py
for an example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you actually running the snippets yourself? They don't pass for me.
bigtable/nox.py
Outdated
@nox.session | ||
def lint(session): | ||
"""Run linters. | ||
|
||
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
docs/bigtable/snippets.py
Outdated
client = bigtable.Client(project='my-project', admin=True) | ||
for example in _find_examples(): | ||
to_delete = [] | ||
print '%-25s: %s' % _name_and_doc(example) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, the changes today look right to me. However, I'm pretty sure that they won't pass. Have you run nox -e snippets
to check?
@sumit-ql, can you please update |
Working on fixing the tests, there are dependency failures. |
@sangramql The file You will need to update Nox via: $ /path/to/venv/bin/pip uninstall nox-automation
$ /path/to/venv/bin/pip install nox |
bigtable/nox.py
Outdated
|
||
@nox.session | ||
@nox.parametrize('py', ['2.7', '3.6']) | ||
@nox.parametrize('py', ['2.7']) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
docs/bigtable/snippets.py
Outdated
|
||
@pytest.fixture(scope='module') | ||
def client(): | ||
return bigtable.Client(project='my-project', admin=True) | ||
return bigtable.Client(project='grass-clump-479', admin=True) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
docs/bigtable/snippets.py
Outdated
@@ -47,6 +51,7 @@ def to_delete(): | |||
item.delete() | |||
|
|||
|
|||
@pytest.mark.order1 |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Hi @tseaver , Fixed the tests, could you please review it. |
@sumit-ql, it looks like there's a CircleCI failure:
|
Hi @tseaver , Fixed the tests, could you please review it. |
@tseaver can you suggest the help on this failure. index link is failing for some files, but looks like passing for some. Do we need to change all the links? |
@sangramql Since PR #6014, |
bigtable/docs/snippets.py
Outdated
PRODUCTION = enums.Instance.Type.PRODUCTION | ||
SERVER_NODES = 3 | ||
STORAGE_TYPE = enums.StorageType.SSD | ||
LABEL_KEY = u'python-system' |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
bigtable/docs/snippets.py
Outdated
|
||
# Assuming that there is an existing instance with `INSTANCE_ID` | ||
# on the server already. | ||
# to create an instance see 'link' |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
bigtable/docs/snippets.py
Outdated
operation.result(timeout=100) | ||
# [END bigtable_create_cluster] | ||
cluster2 = instance.cluster(cluster_id) | ||
assert cluster2.exists() |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
bigtable/docs/snippets.py
Outdated
assert instances_list.__len__() is not 0 | ||
|
||
|
||
def test_bigtable_list_clusters(): |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
bigtable/docs/snippets.py
Outdated
client = Client(admin=True) | ||
instance = client.instance(INSTANCE_ID) | ||
(clusters_list, failed_locations_list) = instance.list_clusters() | ||
# [END bigtable_list_clusters] |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
For example: | ||
|
||
.. literalinclude:: snippets.py | ||
:start-after: [START bigtable_list_clusters] |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
||
.. literalinclude:: snippets.py | ||
:start-after: [START bigtable_list_clusters] | ||
:end-before: [END bigtable_list_clusters] |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
For example: | ||
|
||
.. literalinclude:: snippets.py | ||
:start-after: [START bigtable_list_clusters] |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
||
.. literalinclude:: snippets.py | ||
:start-after: [START bigtable_list_clusters] | ||
:end-before: [END bigtable_list_clusters] |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@sangramql Please also add snippets for methods,
|
@sangramql Thanks for sticking with this PR! If you can address the suggestions / requested new snippets from @AVaksman, I think we'll be ready to merge. |
@sangramql I'm pretty sure that if you can create an instance, you should be able to call The only other missing snippet that I see requested by @AVaksman is for |
@sangramql we still need snippets for |
Added snippets for both the methods. update line 258 and iam_permissions line 360. |
No description provided.