Make some tests more lenient - #141
Conversation
tput appears to be optional for this plugin, so the tests should not fail if we cannot find tput.
In some exotic packaging environments like Nixpkgs, we enforce heavy amounts of sandboxing; we do not include git by default in that sandbox. Additionally, in said exotic packaging environments, we should not always assume we are in a Git repository. The Nixpkgs GitHub fetcher functions by downloading a tarball, not the whole Git directory, so the test fails.
| } | ||
|
|
||
| @test 'ysu version exported' { | ||
| (( $+commands[git] )) || skip "git not found" |
There was a problem hiding this comment.
I elected to use pure Zsh when checking if a command is present to avoid a dependency on which.
This increase performance slightly, and also avoids a dependency on which.
| } | ||
|
|
||
| @test 'ysu - _write_ysu_buffer invalid' { | ||
| (( $+commands[tput] )) || skip "tput not found" |
There was a problem hiding this comment.
I'm not sure about this one. I would want the CI/CD pipeline to fail if tput is not installed rather than fail silently.
There was a problem hiding this comment.
That's understandable. I can drop the tests: skip tests requiring tput if not present commit if you prefer. I added this because YSU gracefully handles a missing tput.
|
@tomodachi94 sorry coming back to this after so long. I dont think I agree with the changes here because they introduce the risk of silently failing tests. Could you explain what you are trying to achieve? Maybe we can find an alternative solution for your problem. |
This is part of my work to run unit tests in the Nixpkgs
zsh-you-should-usepackage, so that potential breakages are caught early.