-
-
Notifications
You must be signed in to change notification settings - Fork 161
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
ENH: Test full output and coverage #230
Conversation
Okay all green, ready for review/merge from my end. @thequackdaddy perhaps you could look? |
Looks like we are already at 93.4% coverage, not bad! |
@larsoner Sorry for my non-response! Busy week. I took a look and I think its a good start. I'll totally confess you are clearly more up-to-speed with some of this than I am. I wasn't thinking about adding in a mini-sphinx build to test against, so I think it looks good. That looks impressive and 93.4% coverage is excellent. Obviously, the maintainers would be a better reviewer than me though. |
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 generally think this is an awesome improvement to the testing. Though I don't really like how the test fixtures, i.e. the numpydoc, is far from the assertions about it, and that at the same time the purpose of each test case is very mixed... I.e. the tests aren't very legible, which is not improved by the use of string matching over html.
I don't have any constructive suggestions at this point, and would be happy to see this merged.
numpydoc/tests/test_full.py
Outdated
from sphinx.util.docutils import docutils_namespace | ||
|
||
|
||
# Test framework adapted from sphinx-gallery |
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.
No licensing requirements?
numpydoc/tests/tinybuild/conf.py
Outdated
'sphinx.ext.intersphinx', | ||
'numpydoc', | ||
] | ||
project = 'nd_test_mod' |
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.
It took me a while to work out what nd is. Maybe expand it?
@@ -0,0 +1,51 @@ | |||
"""Numpdoc test module. |
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.
"""Numpdoc test module. | |
"""Numpydoc test module. |
numpydoc/tests/test_full.py
Outdated
assert 'stdtypes.html#dict' in html | ||
|
||
|
||
def test_function(sphinx_app): |
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.
def test_function(sphinx_app): | |
def test_my_function(sphinx_app): |
Otherwise this sounds too generic
numpydoc/tests/test_full.py
Outdated
return app | ||
|
||
|
||
def test_class(sphinx_app): |
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.
def test_class(sphinx_app): | |
def test_MyClass(sphinx_app): |
Basically the idea is to test that the end output (HTML) is as it should be. I agree that this is not so great for inspecting where in numpydoc the failures arose, but it is good for ensuring that we don't introduce failures in the final output (what is correct). Ideally tests for new functionality are built at the fine-grained level as encapsulated as possible (like what we have at Another way to look at it is that at the end of the day we want |
Pushed a commit with the suggested changes, plus a tiny bit more explanatory text comments for the HTML assertions |
Thanks!
|
Over in Sphinx-gallery for about a year we've been testing full builds of sphinx using Pytest:
https://github.com/sphinx-gallery/sphinx-gallery/blob/master/sphinx_gallery/tests/test_full.py
It's convenient because:
pytest
form.make clean; make html
from within thenumpydoc/tests/tinybuild
directory and looking at the rendered HTML.nd_test_mod
module intinybuild
.I've shown how to use this framework in some basic cases here. I've also added some assertions that are bad (marked by
XXX
) that #221 should fix (@thequackdaddy after this PR is merged and you rebase, you can change a couple ofin
s below tonot in
s to assert that the*args, **kwargs
situation has been fixed).This PR also attempts to enable
codecov
.