Add test for AsyncLog respecting GIT_DIR#2387
Conversation
|
look how we use |
Yeah that's gonna be tough, i think the more realistic approach would be to put gitui in a lib and only start it in interactive mode when used as a bin. the lib version could allow us to provide a different rendering backend to ratatui and then we could run snapshottests against that and fully control the inputs we send to the binary |
|
Since there is support for snapshots in ratatui (https://ratatui.rs/recipes/testing/snapshots/), I think your approach would work well. It guess it would require a couple of changes to the app, but eventually testing would be quite straightforward. I’ll try to create a PoC once I’ve got a bit of spare time on my hand. :-) |
|
Awesome, thank yoU! |
|
@cruessler Hm did it make the CI flaky? see https://github.com/extrawurst/gitui/actions/runs/11362704155/job/31605115788 |
That’s definitely possible. I’ll have a look! Do you happen to know whether |
@cruessler i don’t think it’s about the file it’s about making sure any test that this can interfere with needs to have that annotation |
|
Does it make sense to run this test as part of a different test suite in its own process? Something like a separate invocation of |
|
the problem is that we do not even know what the result is. we should unwrap so that we can see exactly what failed. i will roll this PR back, can you open a new PR then that redoes it but unwraps the result at the end so we can see what is going wrong? |
This reverts commit 9c433b4.
|
@cruessler its reverted |
|
@extrawurst I created a follow-up PR: #2409. |
This is a follow-up to #2301. It adds a test for
AsyncLog::fetch_helper_without_filterrespectingGIT_DIR. The docs tostd::env::set_varsay that it is only safe to be used in single-threaded programs. Could this ever become an issue? On my machine,make checkwas green.(Creating snapshot tests running the
gituibinary has proven to be rather challenging. So far, I have not found a crate that would work withenable_raw_modewhich is why I decided to open this PR.)