-
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
Adding ability to run doctests with datastore system tests. #2738
Conversation
def test_it(self): | ||
from sphinx import application | ||
|
||
docs_dir = self._make_temp_docs() |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
return docs_dir | ||
|
||
def test_it(self): | ||
from sphinx import application |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
be9f0dc
to
5a5b307
Compare
5a5b307
to
4e7d49f
Compare
@tseaver PTAL |
@tseaver PTAL |
@@ -380,7 +380,7 @@ def parent(self): | |||
return self._parent | |||
|
|||
def __repr__(self): | |||
return '<Key%s, project=%s>' % (self.path, self.project) | |||
return '<Key%s, project=%s>' % (self._flat_path, self.project) | |||
|
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.
>>> entity['answer'] = 42 | ||
>>> entity | ||
<Entity('EntityKind', 1234) {'answer': 42}> | ||
>>> query = client.query(kind='EntityKind') |
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.
super(Entity, self).__repr__()) | ||
else: | ||
return '<Entity %s>' % (super(Entity, self).__repr__()) | ||
return '<Entity %s>' % (super(Entity, self).__repr__(),) |
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.
self.assertEqual(repr(entity), "<Entity/bar/baz {'foo': 'Foo'}>") | ||
entity_vals = {'foo': 'Foo'} | ||
entity.update(entity_vals) | ||
expected = '<Entity%s %s>' % (flat_path, entity_vals) |
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.
@tseaver Only comments on the doctest itself / associated Any comments on the approach of making a fake docs directory and then running doctest there? |
We're going to need a way to test all the examples, not just those embedded in docstrings: do you have a plan for that? |
@dhermes Memory eludes me: what stops us from just running |
Yes, though that is "beyond" the scope of this PR. There are two possible approaches that I can see. The first is to "guess" which hand-written RST files apply to a given package (I am not "pro" on this approach). The second is as follows:
The synthesized one is an attempt to isolate on a per-package basis (just as is done with the system tests). It's not strictly necessary. The "real" reason I did it was because our docs build takes quite a long time (since the project is so large), and I wanted to have a snappier doctest build. |
@tseaver Can we keep moving on this? |
@dhermes I'd still say that running |
|
||
from google.cloud import datastore | ||
import os | ||
os.environ['GOOGLE_CLOUD_PROJECT'] = u'my-project' |
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.
This is fine, though I see it having two issues:
|
Plan moving forward:
|
LGTM. |
Adding ability to run doctests with datastore system tests.
Since Travis / CircleCI won't run this by default, here is some sample output: