Re: [PATCH 1/7] test-lib: add a "test_expect_todo", similar to "test_expect_failure"
From: Phillip Wood <hidden>
Date: 2022-03-24 11:24:13
On 23/03/2022 22:13, Junio C Hamano wrote:
Derrick Stolee [off-list ref] writes:quoted
The thing I'm hoping to see from a final version is that a top-level helper like test_expect_todo will expect at least one test_todo helper to be executed inside of the test (perhaps communicated by setting a special GIT_TEST_* environment variable?) and if any ofI was hoping that we can do without test_expect_todo. test_expect_success can turn itself into test_expect_todo when it sees test_todo is invoked even once in it. And Phillip's outline actually implements the idea, if I am not mistaken.
You are correct, there is no test_expect_todo in the outline I posted, test_todo lives within test_expect_success and works like test_must_fail.
quoted
the test_todo lines change from fail to pass, then that is communicated as a _failure_ from CI's perspective. Let us discover if we have accidentally "fixed" any of these test cases and update the tests accordingly.In other words, we do not want to lose the "TODO fixed" we have been getting out of test_expect_failure, which I agree with.
I read Stolee's comments the other way, that we want the test harness to see the test fail rather passing as it does with the "TODO fixed" feature. In one of my early contributions I inadvertently fixed a submodule test and did not realize until someone pointed it out because the CI passes rather than fails when a test_expect_failure is fixed.
I am not sure if Phillip's outline had that feature.
In my outline the test fails if any command marked by test_todo is successful and test_todo prints a messaging saying the command was unexpectedly successful. Implementing the "TODO fixed" feature gets tricky when there is more than one test_todo within a single test_expect_success - what if one is test_todo command is successful and the others fail? Best Wishes Phillip
quoted
I can predict writing a test case with multiple test_todo lines that need to be updated to drop the test_todo helpers one-by-one as a change is being introduced.Yes.