Skip to content
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

Merged
merged 4 commits into from Oct 27, 2020

Conversation

hoefling
Copy link
Contributor

@hoefling hoefling commented Oct 8, 2020

Signed-off-by: oleg.hoefling oleg.hoefling@gmail.com

Subject: Register public markers in sphinx.testing.fixtures

Feature or Bugfix

  • Feature

Purpose

When writing tests for a Sphinx extension, the usage of sphinx or test_params markers raises a PytestUnknownMarkWarning:

  test_spam.py:0: PytestUnknownMarkWarning: Unknown pytest.mark.sphinx - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/mark.html
    @pytest.mark.sphinx("html", testroot="spam")

The workaround is to register the markers in pytest.ini:

[pytest]
markers =
  sphinx
  test_params

To avoid this and offer the markers automatically, this PR moves registration of sphinx and test_params markers to sphinx.testing.fixtures plugin. Only two markers are exposed by the public plugin, so the remaining markers (apidoc and setup_command) are left in setup.cfg.

@hoefling
Copy link
Contributor Author

hoefling commented Oct 8, 2020

@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.

@tk0miya tk0miya added type:proposal a feature suggestion type:tests labels Oct 25, 2020
@tk0miya tk0miya added this to the 3.3.0 milestone Oct 25, 2020
@tk0miya
Copy link
Member

tk0miya commented Oct 25, 2020

Copy link
Member

@tk0miya tk0miya left a 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.

@@ -21,6 +21,21 @@
from sphinx.testing.util import SphinxTestApp, SphinxTestAppWrapperForSkipBuilding


markers = [
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tk0miya maybe PUBLIC_MARKERS?

Copy link
Contributor Author

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.

Copy link
Member

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?

Copy link
Contributor Author

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>
@hoefling hoefling requested a review from tk0miya October 25, 2020 10:54
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
@tk0miya tk0miya merged commit 95c3aa2 into sphinx-doc:3.x Oct 27, 2020
@tk0miya
Copy link
Member

tk0miya commented Oct 27, 2020

Thank you for your work! Merged :-)

tk0miya added a commit that referenced this pull request Oct 27, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type:proposal a feature suggestion type:tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants