Comments (9)
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.
from rstest.
Thanks for getting back to me. I tried this with a symlink also, that didn't work either.
from rstest.
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.
from rstest.
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.
from rstest.
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.
from 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.
from rstest.
0.18.2 published
from rstest.
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.
from rstest.
Ok,
can you open a new ticket for that with also a proposed syntax that we can discuss?
from rstest.
Related Issues (20)
- Generate tests from json files HOT 2
- [question] Test with different specializations of a generic type? HOT 4
- '#[once]' cleanup after tests executed HOT 1
- `#[ignore]` at the top only applies to the first case HOT 3
- Consider supporting `wasm-bindgen-test` for async test HOT 3
- Allow customizing the "length" of the test case names from the path
- Separating test input data & expected values? HOT 1
- Unable to silence lints HOT 1
- New #[files] feature does not recompile on file change HOT 5
- Consider allowing to rename the crate by passing an attribute `crate = ...` to the proc-macro HOT 9
- vscode/rust-analyzer "debug overlay action" not working anymore HOT 2
- Question: tests failed by memory allocation of x bytes failure` when only running many cases once HOT 2
- Allow `clippy::too_many_arguments` HOT 6
- Please clearly state the MSRV in the README and documentation and use the "rust-version" flag. HOT 2
- Add capability to ignore arguments HOT 3
- [vscode] text wrapping for run/debug test buttons
- Misleading error messaging when defining a test that includes a lifetime argument HOT 1
- Support argument destructuring for `#[values(...)]` HOT 1
- Injecting static types HOT 5
- Create a fixture from `files` attribute HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rstest.