-
Notifications
You must be signed in to change notification settings - Fork 239
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
have pytest run code examples in docs + have travis build docs #59
Conversation
Note, I expected Travis to fail here. I fixed the first several errors from running the code examples in the docs, but had to stop short of fixing all of them. Hopefully @dabeaz or another contributor can take it from here! |
@@ -4,7 +4,8 @@ python: 3.5 | |||
sudo: false | |||
|
|||
install: | |||
- python3 setup.py install | |||
- travis_retry pip install -e .[test] |
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.
Why the use of travis_retry
?
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.
I saw it in another project's .travis.yml (which seemed like it knew what it was doing), and it seemed like a zero-cost line of defense against e.g. transient network failures and other things that shouldn't cause the build to fail. Any reason not to?
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.
I honestly don't know, hence the question. 😄
I think for a first PR it should only worry about building the documentation and not conflate also making the examples all work with py.test as one doesn't necessitate the other. Having said that, the build rule could also run |
I'm not sure how easy it will be to make different code examples in the docs work under testing. All things equal, I'd probably want to start with something really simple first. For example, what Brett suggested where testing mainly just makes sure that the docs build. I'm not an expert at setting this up though so I'll have to defer to those with more experience. |
- comment out running code examples from docs - run linkcheck - turn warnings into errors - run with -q
Implemented the latest requested changes in 86ff1f7. Fixed a few of the resulting build errors. Then I got this one:
I tried changing
Hopefully this is a good start though and you can take it from here. I've added you both as collaborators to my fork in case you want to play with this branch there, otherwise you could merge these changes to a branch here upstream and get it in the shape you want it to merge. [1] Had to replace backticks with apostrophes to get GitHub to render properly |
I think the error you're seeing is because there's no definition for To prevent this from being held up and so you get credit for the PR, @jab , why don't you remove the If this is too much of a hassle, though, just let me know and I can create a PR for all of this. |
Removed |
Tests now pass. |
Just to confirm, you want these changes backed out before merging? https://github.com/dabeaz/curio/pull/59/files#diff-1d39468fa376ebb3d0827a66affef99f I can do that, but as far as I can tell they're not hurting anything, and someone will just have to do them again once the docs' code examples start getting tested. |
tutorial | ||
reference | ||
howto | ||
devel |
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.
Btw, I moved these under the .. toctree::
here assuming that was the intention. Also added devel
because otherwise sphinx generates a warning that it's not part of any toctree. The resulting built docs are the same, except the bulleted list in the "Contents" section of index.html is now generated automatically, including 2nd-level topics as per the :maxdepth: 2
(which I didn't change). Could change that to :maxdepth: 1
to make it condensed, as it was with the manually-generated bulleted list before.
Backing out the doc changes to make py.test pass are a call for @dabeaz , but my assumption is that unless you convert all the docs then doing it piecemeal might look a bit odd. |
I'm going to accept this, but I may revert the devel.rst docs back to my original style afterwards. Wasn't my intent for the docs to necessarily follow a doctest style. |
Wasn't trying to cramp your style, just saw #57 (comment) and said "I know how to do that!" Just trying to be helpful. |
Yep. No problem! The 'devel.rst' doc is a big work in progress so a lot of stuff there is actively changing. Honestly, I hadn't thought about doctest too much considering how weird the interactive interpreter is for experimenting with coroutines. |
Gotcha. Hope the PR ends up being helpful. |
Proof of concept. Anyone want to take it from here?
ref: #57