GithubHelp home page GithubHelp logo

Comments (9)

la10736 avatar la10736 commented on June 10, 2024

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.

stonecharioteer avatar stonecharioteer commented on June 10, 2024

Thanks for getting back to me. I tried this with a symlink also, that didn't work either.

from rstest.

stonecharioteer avatar stonecharioteer commented on June 10, 2024

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.

la10736 avatar la10736 commented on June 10, 2024

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.

not-my-profile avatar not-my-profile commented on June 10, 2024
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.

la10736 avatar la10736 commented on June 10, 2024

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.

la10736 avatar la10736 commented on June 10, 2024

0.18.2 published

from rstest.

stonecharioteer avatar stonecharioteer commented on June 10, 2024

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.

la10736 avatar la10736 commented on June 10, 2024

Ok,
can you open a new ticket for that with also a proposed syntax that we can discuss?

from rstest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.