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] Explore alternative notation for declaring file names in mdtests #15695

Open
MichaReiser opened this issue Jan 23, 2025 · 2 comments · May be fixed by #15704
Open

[red-knot] Explore alternative notation for declaring file names in mdtests #15695

MichaReiser opened this issue Jan 23, 2025 · 2 comments · May be fixed by #15704
Labels
help wanted Contributions especially welcome red-knot Multi-file analysis & type inference testing Related to testing Ruff itself

Comments

@MichaReiser
Copy link
Member

Description

Our mdtest framework allows multifile tests. The file's path is declared as an attribute in the code snippet:

```pyi path=/typeshed/stdlib/builtins.pyi
class Custom: ...

custom_builtin: Custom
```

The downside of this is that the paths arent visible when rendering the markdown file on Github, which makes it harder to understand the test.

Image

We should explore if there are other notations for specifying a file's path that is visible when rendered on GitHub. We probably want to support both notations (the old and new one) for now to avoid having to rewrite all tests.

E.g. we could use a bold text right before a code snippet as the file path.

**/typeshed/stdlib/builtins.pyi**

```pyi
class Custom: ...

custom_builtin: Custom
```

The ideal solution would be if we can get GitHub to render the file's attributes because even the information that it is a pyi file is relevant.

@MichaReiser MichaReiser added help wanted Contributions especially welcome testing Related to testing Ruff itself red-knot Multi-file analysis & type inference labels Jan 23, 2025
@MichaReiser
Copy link
Member Author

Github feature request https://github.com/orgs/community/discussions/77414

@sharkdp
Copy link
Contributor

sharkdp commented Jan 24, 2025

Another thing to keep in mind is that the original plan for MDTests envisioned other metadata fields besides path=. Like stage= if we ever want to write tests for incremental computation:

```py path=b.py stage=1
# b.py
x = 2
```

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
2 participants