~/.choosenim/toolchains/nim-1.6.12/lib/pure/unittest.nim(552, 5) Warning: The bare except clause is deprecated; use except CatchableError: instead [BareExcept]
There is of course a bare except in unittest.nim at that location, but as it's part of the standard library and there are no bare except clauses in my code I'm not sure what the best resolution is. I see the recommendation in the unittest docs to use Testament instead, but that would require changing all my working test code, right? I'd like to avoid that. Would it be acceptable to submit a PR for unittest changing the bare except to except CatchableError:?
I actually reported this on GitHub just yesterday :) It was addressed almost immediately by https://github.com/nim-lang/Nim/pull/21728 which I imagine will be in the next point release. For now there's a pragma that can silence the warning:
{.warning[BareExcept]:off.}
Or as a compiler flag --warning:BareExcept:off
Would it be acceptable to submit a PR for unittest changing the bare except to except CatchableError:?
No, instead the warning will be disabled, it always was a bad idea.
Are you saying it will no longer be a warning? I kept seeing the warning everywhere and it was drowning out useful warning messages, so if it's being removed then that's good.
If not, are you meaning that the warnings will be removed from the standard library specifically? I've been getting around the warnings by having except`s for `CatchableError and Defect, respectively, but if I won't have to do that then that'd be great.
Are you saying it will no longer be a warning?
Yes.
$ testament p "tests/test?.nim"
I'm not sure if that's because Testament just swallows console output from a lower-level test runner, or because it runs the tests with that pragma.