[ty] Use datatest instead of dirtest#21937
Conversation
9ed9114 to
97e7066
Compare
Diagnostic diff on typing conformance testsNo changes detected when running ty on typing conformance tests ✅ |
|
|
There was a problem hiding this comment.
Nice! I think this means that we can get rid of the "note" block here saying that you probably need a build.rs file if you use mdtests in a crate:
Line 37 in 0138cd2
We should instead just say that it's recommended to use mdtest in combination with datatest.
Also, you should use mdtest.py 😆 the experience is soooo much better!!
I believe you. I just don't write many mdtests (I only occasionally debug them) |
|
For context, on the right split you can see that rust-analyzer is able to provide me with all the individual tests aka the file name in mdtest suite and I can select on any one of them and it will only run that specific test and then re-run that same test however many times I want: Screen.Recording.2025-12-12.at.18.36.08.mov |
|
Hmm. I guess that's not unexpected given the approach (note, I don't think this worked for the formatter or parser before because we only had one test). Before, rust-analyzer was able to see all tests because of the macro expansion (but I doubt that it ever updated when files were added or removed). Now, there's no such macro expansion happening anymore. |
Yeah, in those cases I'd ask rust-analyzer to re-build the proc macros which would then update this list. Note that this is different than restarting the server. |
|
I'm not against this change, it's just that this has been a core part of my workflow. I guess I'll have to try out |
Yeah. Losing that certainly feels painful. We might need to write a mdtest LSP |
|
I spent some time trying to fix the LSP regression but, unfortunately, I think this will require changes in r-a. I hoped that all that was missing is I opened rust-lang/rust-analyzer#21259 upstream |
|
Wow, thank you for spending time in looking into this, I appreciate that! |
f690d6f to
ea4d105
Compare

Summary
Same as #21933 but for our mdtests.
datatest-stableuses a custom test-harness that mimicscargo testand supportscargo nextestto create a separate test for every file found in a given directory.Unlike
dir-tests,datatest-stabledoesn't require re-compilation after adding or removing a test file (because it uses a custom test harness). This should allow us (people like me who aren't using the mdtest Python script) to iterate faster on mdtests, since we no longer have to recompilety_python_semanticwhenever a markdown file changes.Test plan
mdtestson main:mdtestson this branch:I used the
mdtest.pyfile (for the first time) and verified that it picks up changes and only runs the changed tests.I verified that a new test file is picked up without needing to recompile
ty_python_semantic.