-
Notifications
You must be signed in to change notification settings - Fork 72
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
👌 Improve and test github needservice
directive
#1113
Conversation
- remove duplication of request mocking solutions (responses is more popular than requests-mock) - remove superfluous mocking in basic docs tests - add test for github `needservice` directives - replace raising`NeedGithubServiceException` with emitting `needs.github` warnings - pass the directive to the service (in a non-breaking manner) so that it can be used to add the directive source location to the warnings - Replace remaining tests that used `Sphinx` with `SphinxTestApp`, which can be "cleaned" after running (otherwise later test were emitting warnings due to these earlier tests)
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #1113 +/- ##
==========================================
+ Coverage 83.93% 85.81% +1.88%
==========================================
Files 56 56
Lines 6462 6480 +18
==========================================
+ Hits 5424 5561 +137
+ Misses 1038 919 -119
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@pytest.mark.parametrize( | ||
"test_app", [{"buildername": "html", "srcdir": "doc_test/doc_basic"}], indirect=True | ||
) | ||
def test_build_html(test_app): | ||
responses.add_callback( |
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.
Does removing this mean, our tests are firing now real requests to the GitHub API.
Or have I missed the locations, where this is still mocked?
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.
doc_test/doc_basic
has no needservice
directives in, i.e. there are no requests to make 😄
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.
argh sure, thought these removals had some functional reason.
But now it makes all sense...
By codecov, this directive was completely untested in the current test suite, so I added a test and also improved some other things I noticed:
needservice
directivesNeedGithubServiceException
with emittingneeds.github
warningsservice.request
method (in a non-breaking manner) so that it can be used to add the directive source location to the warningsSphinx
withSphinxTestApp
, which can be "cleaned" after running (otherwise later test were emitting warnings caused by global variables previously mutated by these earlier tests)