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

[red-knot] mdtest should fail if you have a triple-backtick block that is unclosed #14934

Closed
AlexWaygood opened this issue Dec 12, 2024 · 2 comments · Fixed by #14965
Closed
Assignees
Labels
help wanted Contributions especially welcome red-knot Multi-file analysis & type inference testing Related to testing Ruff itself

Comments

@AlexWaygood
Copy link
Member

AlexWaygood commented Dec 12, 2024

If you have an mdtest like this at the end of the Markdown file, it doesn't fail:

# bytes should be inferred as strings

```py
x = b"42"

reveal_type(x)  # revealed: str

That's because the backticks are never closed, so mdtest doesn't even recognise this as a test snippet. I keep on making this mistake locally and wondering why my tests aren't even running! It would be ideal if the framework could detect this and tell me that my test file is invalid because the backticks were never closed.

@AlexWaygood AlexWaygood added help wanted Contributions especially welcome red-knot Multi-file analysis & type inference testing Related to testing Ruff itself labels Dec 12, 2024
@sharkdp
Copy link
Contributor

sharkdp commented Dec 12, 2024

Yes, please! Ran into this multiple times already.

@InSyncWithFoo
Copy link
Contributor

This seems trivial to fix. A PR should be ready by Saturday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Contributions especially welcome red-knot Multi-file analysis & type inference testing Related to testing Ruff itself
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants