Skip to content

Conversation

@mfussenegger
Copy link
Member

@mfussenegger mfussenegger commented Jan 19, 2026

Follow up to #767

@coderabbitai

This comment was marked as spam.

@mfussenegger mfussenegger changed the title j/doctests Re-add execution of doctests Jan 19, 2026
respond, the request is automatically routed to the next server:

>>> invalid_host = 'http://not_responding_host:4200'
>>> invalid_host = 'http://127.0.0.1:4201'
Copy link
Member Author

Choose a reason for hiding this comment

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

Haven't investigated why, but on my machine resolving a hostname that doesn't exist takes way longer than having it resolve to localhost on a port where hopefully nothing runs.

Potential follow up would be to generally restructure this. http.rst and client.rst have lots of overlap.

>>> invalid_host = "invalid_host:9999"
>>> even_more_invalid_host = "even_more_invalid_host:9999"
>>> http_client = HttpClient([crate_host, invalid_host, even_more_invalid_host], timeout=0.3)
>>> invalid_host1 = "192.0.2.1:9999"
Copy link
Member Author

Choose a reason for hiding this comment

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

makeSuite = unittest.TestLoader().loadTestsFromTestCase


def test_suite():
Copy link
Member Author

Choose a reason for hiding this comment

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

pytest afaik doesn't support the test_suite discovery. Tests are picked up based on filename pattern and LayerTest/LayerUtilsTest still get executed

print(s) # noqa: T201


def test_docs(doctest_node):
Copy link
Member Author

@mfussenegger mfussenegger Jan 19, 2026

Choose a reason for hiding this comment

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

I also tried --doctest-glob="*.rst" (https://docs.pytest.org/en/stable/how-to/doctest.html) instead with a autouse fixture, but that would also be used in the other tests and we'd have two crate instances running in parallel.

So this seemed like the better option.

@mfussenegger mfussenegger marked this pull request as ready for review January 19, 2026 15:42
@mfussenegger mfussenegger requested a review from amotl January 19, 2026 15:42
Copy link
Member

@amotl amotl left a comment

Choose a reason for hiding this comment

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

Thank you very much. 💯

@mfussenegger mfussenegger merged commit 7ec1b56 into main Jan 20, 2026
16 checks passed
@mfussenegger mfussenegger deleted the j/doctests branch January 20, 2026 06:07
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.

3 participants