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
Register public markers in sphinx.testing.fixtures #8304
Conversation
@tk0miya can you aid me in resolving the mysterious test failures? The changes in this PR are minimal and shouldn't affect the tests, also I can't reproduce them locally with a 3.10 alpha built from source. |
Note: I found this technique on pytest document: https://docs.pytest.org/en/stable/example/markers.html#custom-marker-and-command-line-option-to-control-test-runs |
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.
Sorry for late response. Looks good. But it would be better to release this earlier. So could you rebase this into 3.x branch? Then it will be released in nearly months (3.3 will be shipped within a week, maybe).
About the CI errors, they have been fixed now. Sorry for confusing. That will be also fixed on rebasing.
sphinx/testing/fixtures.py
Outdated
@@ -21,6 +21,21 @@ | |||
from sphinx.testing.util import SphinxTestApp, SphinxTestAppWrapperForSkipBuilding | |||
|
|||
|
|||
markers = [ |
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.
How about renaming this like DEFAULT_MARKERS
or something similar? I feel it would be better to use a CONSTANT name and good adjective for this.
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.
@tk0miya maybe PUBLIC_MARKERS
?
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.
@tk0miya however, maybe PUBLIC_MARKERS
is unsuitable since it suggests some "private" markers also exist somewhere hidden.
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.
DEFAULT_INSTALLED_MARKERS
or DEFAULT_ENABLED_MARKERS
?
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.
Changed to DEFAULT_ENABLED_MARKERS
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
Thank you for your work! Merged :-) |
Signed-off-by: oleg.hoefling oleg.hoefling@gmail.com
Subject: Register public markers in sphinx.testing.fixtures
Feature or Bugfix
Purpose
When writing tests for a Sphinx extension, the usage of
sphinx
ortest_params
markers raises aPytestUnknownMarkWarning
:The workaround is to register the markers in
pytest.ini
:To avoid this and offer the markers automatically, this PR moves registration of
sphinx
andtest_params
markers tosphinx.testing.fixtures
plugin. Only two markers are exposed by the public plugin, so the remaining markers (apidoc
andsetup_command
) are left insetup.cfg
.