tests: replace "naked except clause" to avoid check-code.py error
This is a part of preparation to apply checking with check-code.py on
code fragments embedded in *.t test scripts.
#require docutils gettext $ $TESTDIR/check-gendoc it checking for parse errors