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

Fix and capture test app build warnings #192

Merged
merged 4 commits into from
Oct 21, 2023
Merged

Conversation

jnikula
Copy link
Owner

@jnikula jnikula commented Oct 9, 2023

Fix docutils warnings in app = Sphinx(). They're usually not visible, but when hitting other errors, pytest has captured the stderr and emits the warnings. Fix them, capture the stderr, ensure there are no errors with app = Sphinx() going forward, and compare the errors against expected errors like the parser tests do.

Sphinx testing currently results in a lot of stderr garbage from
docutils. They don't normally show up, but when there's a test failure,
pytest emits the stdout/stderr it has captured.

Apparently docutils has some global configuration that does not play
well in the test setup. Do what Sphinx command-line invocation in
sphinx.cmd.build package does, and wrap Sphinx invocation in a

    with patch_docutils(confdir), docutils_namespace():

block to make docutils behave nicely.
By default, Sphinx emits color codes in stdout/stderr. Disable them,
similar to how Sphinx command-line invocation does.
Grab the Sphinx warning reporting, and ensure there are no errors after
app creation.
Similar to parser testing, check the actual warning output against the
expected output.

Paths need to be filtered out from the actual output. It's a bit hacky,
but seems to work.
@jnikula
Copy link
Owner Author

jnikula commented Oct 9, 2023

The errors can be seen e.g. with make docker-test.fedora-37. It's hitting an issue with stdbool.h, but the logs have:

----------------------------- Captured stderr call -----------------------------
WARNING: while setting up extension sphinx.addnodes: node class 'toctree' is already registered, its visitors will be overridden
WARNING: while setting up extension sphinx.addnodes: node class 'desc' is already registered, its visitors will be overridden
WARNING: while setting up extension sphinx.addnodes: node class 'desc_signature' is already registered, its visitors will be overridden
WARNING: while setting up extension sphinx.addnodes: node class 'desc_signature_line' is already registered, its visitors will be overridden
WARNING: while setting up extension sphinx.addnodes: node class 'desc_content' is already registered, its visitors will be overridden
WARNING: while setting up extension sphinx.addnodes: node class 'desc_inline' is already registered, its visitors will be overridden

And it goes on and on.

Copy link
Collaborator

@BrunoMSantos BrunoMSantos left a comment

Choose a reason for hiding this comment

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

Nice fixes!

@jnikula jnikula merged commit e4e303b into master Oct 21, 2023
5 checks passed
@jnikula jnikula deleted the test-app-build-warnings branch October 21, 2023 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants