| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| def test_it(self): | ||
| from sphinx import application | ||
|
|
||
| docs_dir = self._make_temp_docs() |
| return docs_dir | ||
|
|
||
| def test_it(self): | ||
| from sphinx import application |
| def __repr__(self): | ||
| return '<Key%s, project=%s>' % (self.path, self.project) | ||
| return '<Key%s, project=%s>' % (self._flat_path, self.project) | ||
|
|
| >>> entity['answer'] = 42 | ||
| >>> entity | ||
| <Entity('EntityKind', 1234) {'answer': 42}> | ||
| >>> query = client.query(kind='EntityKind') |
| super(Entity, self).__repr__()) | ||
| else: | ||
| return '<Entity %s>' % (super(Entity, self).__repr__()) | ||
| return '<Entity %s>' % (super(Entity, self).__repr__(),) |
| 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) |
|
@tseaver Only comments on the doctest itself / associated repr() changes. Any comments on the approach of making a fake docs directory and then running doctest there? |
Sorry, something went wrong.
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? |
Sorry, something went wrong.
|
@dhermes Memory eludes me: what stops us from just running sphinx-build -b doctest in place in the normal docs directory, rather than synthesizing one? |
Sorry, something went wrong.
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. |
Sorry, something went wrong.
|
@tseaver Can we keep moving on this? |
Sorry, something went wrong.
|
@dhermes I'd still say that running sphinx-build -b doctest (maybe in a separate [testenv:doctest] environment w/ appropriate system-tests deps) would be the right way to move forward: it will pick up any snippets in non-autodoc files, for instance. |
Sorry, something went wrong.
|
|
||
| from google.cloud import datastore | ||
| import os | ||
| os.environ['GOOGLE_CLOUD_PROJECT'] = u'my-project' |
This is fine, though I see it having two issues:
|
Sorry, something went wrong.
|
Plan moving forward:
|
Sorry, something went wrong.
|
LGTM. |
Sorry, something went wrong.
Adding ability to run doctests with datastore system tests.
Adding ability to run doctests with datastore system tests.
| Back | FazBrowse Home | New Git URL |
Since Travis / CircleCI won't run this by default, here is some sample output:
$ tox -e system-tests -- datastore GLOB sdist-make: .../setup.py system-tests inst-nodeps: .../.tox/dist/google-cloud-0.21.0.zip ... system-tests runtests: commands[1] | python .../system_tests/attempt_system_tests.py datastore test_it (datastore.TestDoctest) ... Running Sphinx v1.4.8 making output directory... loading pickled environment... not yet created building [mo]: targets for 0 po files that are out of date building [doctest]: targets for 1 source files that are out of date updating environment: 1 added, 0 changed, 0 removed reading sources... [100%] contents looking for now-outdated files... none found pickling environment... done checking consistency... done running tests... Document: contents ------------------ 1 items passed all tests: 9 tests in constructors 9 tests in 1 items. 9 passed and 0 failed. Test passed. Doctest summary =============== 9 tests 0 failures in tests 0 failures in setup code 0 failures in cleanup code build succeeded. ok ---------------------------------------------------------------------- Ran 1 test in 1.088s OK ____________________________________ summary ____________________________________ system-tests: commands succeeded congratulations :)