Skip to content

docs: test most requests.rst literalinclude#4099

Merged
provinzkraut merged 7 commits intolitestar-org:mainfrom
euri10:docs_2940
Apr 24, 2025
Merged

docs: test most requests.rst literalinclude#4099
provinzkraut merged 7 commits intolitestar-org:mainfrom
euri10:docs_2940

Conversation

@euri10
Copy link
Copy Markdown
Contributor

@euri10 euri10 commented Apr 10, 2025

Description

  • this renames most /docs/examples/request_data files adding a test_ prefix
  • thus the make test-examples command take them into account
  • tests have been added

Closes

Fixes #2940

@euri10 euri10 requested review from a team as code owners April 10, 2025 09:43
@github-actions github-actions bot added area/docs This PR involves changes to the documentation size: medium type/docs pr/external Triage Required 🏥 This requires triage labels Apr 10, 2025
@euri10 euri10 marked this pull request as draft April 10, 2025 09:53
@euri10 euri10 marked this pull request as ready for review April 11, 2025 06:22
@provinzkraut
Copy link
Copy Markdown
Member

Not sure about this one. This would include all the test cases in the examples given in the docs, making them quite cluttered. I think I'd prefer having them separated. It also breaks with the pattern of having them in tests/examples. We should at least be consistent there.

@euri10
Copy link
Copy Markdown
Contributor Author

euri10 commented Apr 12, 2025

oO I entirely missed this test folder and I'll adapt to using it.

this said this is contradictory with #3362 where we have some test in docs/examples/.../test_xxx.py

2 proposals to make it consistent:

  1. what about we use literalinclude: file.py instead of codeblock then we have a test inside tests/examples/file.py ?
  2. what if we add a tab in docs on some code examples to show the corresponding test, idk how esthetically it could appear for the reader so that it doesnt feel cluttered but I think this brings value and promotes a test-oriented first mindset.

@provinzkraut
Copy link
Copy Markdown
Member

this said this is contradictory with #3362 where we have some test in docs/examples/.../test_xxx.py

Ah, I think I was misunderstanding what you were proposing there. Sorry for the confusion.

  1. what about we use literalinclude: file.py instead of codeblock then we have a test inside tests/examples/file.py ?

That's the general idea, and I think how it's done for all things that use literalinclude and have tests. The only exception afaik are the examples for litestar.testing, which themselves are tests, so we just run those directly with pytest.

  1. what if we add a tab in docs on some code examples to show the corresponding test, idk how esthetically it could appear for the reader so that it doesnt feel cluttered but I think this brings value and promotes a test-oriented first mindset.

I like the idea!

Copy link
Copy Markdown
Member

@provinzkraut provinzkraut left a comment

Choose a reason for hiding this comment

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

One thing: Maybe use something simpler than calculating the sha? It's a bit too specific and distracts from the actual content. Maybe just return the size instead?

@provinzkraut provinzkraut merged commit 6f3d745 into litestar-org:main Apr 24, 2025
28 checks passed
@github-actions
Copy link
Copy Markdown

Documentation preview will be available shortly at https://litestar-org.github.io/litestar-docs-preview/4099

@euri10 euri10 deleted the docs_2940 branch April 26, 2025 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/docs This PR involves changes to the documentation pr/external pr/internal size: small Triage Required 🏥 This requires triage type/docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Documentation: Examples using dict[str, UploadFile] don't work as advertised

2 participants