The test requires demandimport. Therefore enable it explicitly.
Also, why did you even notice this? I assume because you were running with HGDEMANDIMPORT=disabled. I'm curious why you do that.
I see this test case fail every time I run the entire test suite, but not if I run it alone. I haven't debugged why yet.
I disabled demandimport because it had caused subtle issues for me in the past. Now chg also disables demandimport. Maybe the correct fix is to replace the stack trace matching to be not depend on demandimport.