Closed stonecharioteer closed 1 year ago
Unfortunately is not possible to use files that are not in your crate. I'll try to fix it in the next days or maybe weeks is much more realistic.
Absolute path should not work either but you can try with a link.... it could works.
Thanks for getting back to me. I tried this with a symlink also, that didn't work either.
If you could walk me through how to fix / debug this, I would love to contribute to your repo. This is something really nice that needs to be more popular for Rust tooling.
Thx! I really appreciate your help... but I've just started to fix it. The real issue here is not to find where is the bug but understand how to define a correct behavior for these cases: every case use the file path also to build the test name to make it simple to identify what are the files involved in the failed tests. So, I cannot use the absolute path to build the tests name and every strategy that involve some kind of shrinking is wrong for some use cases.
Maybe the best is to use a path relative to crate folder but the .
character is sanitized to fit in a valid rust ident
(replaced by _
). I guess that the best compromise is to replace ../
with _UP
: with this rule a relative path like ../../some/folder/more/file.txt
become _UP/_UP/some/folder/more/file.txt
and the sanitized name will be _UP_UP_some_folder_more_file_txt
. Otherwise we can just ignore the ../
segments but in this case we should find the maximum common prefix of all files and then remove it from the absolute path instead of remove the crate path as is today... I don't love this approach because the tests names are not stable and can change if you add or remove some files.
github-repo/ ├─ submodule/ │ ├─ src/ │ │ ├─ lib.rs (this contains the tests) ├─ test_inputs/
I very much think that this is backwards ... the test_inputs should be a submodule of the test code ... not the other way around. I don't think that this should be supported by rstest.
Ok ... _UP
in test names is not the best choice but I didn't find any better way to express this behavior.
I've implemented it and I hope I'll publish a new version tomorrow ... maybe the 0.18.2: I'm considering it just a bug fix.
0.18.2 published
Great! Thanks for your work. Is it possible, btw, to customize the test case names? Right now, the way we've set things up gives us really similar test case names, since we have multiple nested data directories. I'd like to say "hey, generate the test case names only from the last 3 segments of the path" or something.
Ok, can you open a new ticket for that with also a proposed syntax that we can discuss?
I'm trying to use files in a folder in the root level of a repository, while the tests are in a submodule.
I'm unable to use
#[files("../test_inputs/")
in thelib.rs
file so I can glob the particular files I want intest_inputs
, but so far, I have only been getting errors related to how Icannot remove prefix path
. I tried giving an absolute path as well (I'd really prefer to not do this), and that didn't work either. What choices do I have here?