GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Converting remaining datastore snippets to doctests by dhermes · Pull Request #2831 · googleapis/google-cloud-python

Conversation

@dhermes

@dhermes dhermes commented Dec 7, 2016

Copy link
Copy Markdown
Contributor

It's worth noting that I delegated clean-up to system_tests/datastore.py::tearDownModule. This is because (in my experimenting) I discovered that the sphinx.ext.doctest directive testcleanup doesn't run when the thing being tested fails. (FWIW, I think it'd be fairly easy for one of us to send a PR to the Sphinx project and fix that behavior, but that was outside the scope of this PR.)


To make dev a little faster I did the following:

$ tox -e system-tests --recreate --notest
$ source .tox/system-tests/bin/activate
$ GOOGLE_CLOUD_DISABLE_GRPC=true \
> .tox/system-tests/bin/py.test system_tests/datastore.py \
> -k TestDoctest -s -vv

and every time I made a change I just re-installed into the env

$ .tox/system-tests/bin/pip install --upgrade datastore/

Might be worth turning this into a script someday? But I don't want to design it before we know how we'll use it. Just putting it here for posterity.


There is a code-block snippet in datastore._http but that module is non-public so I left it alone.


This package could use some more snippets, but for now at least they are all covered.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
dhermes added 5 commits December 6, 2016 23:39
@dhermes
Converting code-block to doctest in datastore.transaction.
a2d1a7b
In the process, adding a Config.TO_DELETE runtime list so
that test cleanup can handle any loose objects created.
@dhermes
Converting code-block to doctest in datastore.client.
a62b822
@dhermes
Converting code-block to doctest in datastore.key.
ca3553c
@dhermes
Converting code-block to doctest in datastore.entity.
02948c7
@dhermes
Changing doctest indent from 2->3 spaces to be uniform.
893d228
@dhermes dhermes added api: datastore Issues related to the Datastore API. docs labels Dec 7, 2016
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Dec 7, 2016
@daspecster

daspecster commented Dec 7, 2016

Copy link
Copy Markdown
Contributor

I like it!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

theacodes
theacodes approved these changes Dec 8, 2016
View reviewed changes
@dhermes
dhermes merged commit 6b93d40 into googleapis:master Dec 8, 2016
@dhermes
dhermes deleted the moar-datastore-doctests branch December 8, 2016 21:50
@dhermes

dhermes commented Dec 8, 2016

Copy link
Copy Markdown
Contributor Author

Blerg! Python 2 and 3 strike again:
https://travis-ci.org/GoogleCloudPlatform/google-cloud-python/builds/182425545#L2280

Failed example:
    client.get(key)
Expected:
    <Entity(u'EntityKind', 1234L) {u'property': 'value'}>
Got:
    <Entity('EntityKind', 1234) {'property': 'value'}>

Proposed short-term "fix": Only run snippet tests in Python 2? @jonparrott and @tseaver any better ideas?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dhermes dhermes mentioned this pull request Dec 9, 2016
Update versions for mega-release. #2846
Merged
@tseaver

tseaver commented Dec 9, 2016

Copy link
Copy Markdown
Contributor

@dhermes I hate any testing dependency on repr, period (and tracebacks even worse).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dhermes

dhermes commented Dec 9, 2016 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

@tseaver Yes I'm aware of your strong opinion. Any construction constructive suggestion?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tseaver

tseaver commented Dec 9, 2016

Copy link
Copy Markdown
Contributor

@dhermes Either change the example not to use the repr, or change the repr not to use the "dict literal" repr of the keys / values.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

richkadel pushed a commit to richkadel/google-cloud-python that referenced this pull request May 6, 2017
@dhermes
Merge pull request googleapis#2831 from dhermes/moar-datastore-doctests
e762247
Converting remaining datastore snippets to doctests
parthea pushed a commit that referenced this pull request Nov 24, 2025
@dhermes
Merge pull request #2831 from dhermes/moar-datastore-doctests
0b5a80e
Converting remaining datastore snippets to doctests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer
@theacodes theacodes theacodes approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

api: datastore Issues related to the Datastore API. cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@dhermes @daspecster @tseaver @theacodes @googlebot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.