tests: Improve error handling of import failures.
tests: Improve error handling of import failures.

Fixes #6776.

hackerkid/zulip,dhcrzf/zulip,hackerkid/zulip,showell/zulip,andersk/zulip,andersk/zulip,hackerkid/zulip,punchagan/zulip,shubhamdhama/zulip,shubhamdhama/zulip,hackerkid/zulip,punchagan/zulip,brainwane/zulip,synicalsyntax/zulip,timabbott/zulip,rishig/zulip,shubhamdhama/zulip,zulip/zulip,zulip/zulip,tommyip/zulip,brainwane/zulip,tommyip/zulip,timabbott/zulip,showell/zulip,synicalsyntax/zulip,kou/zulip,punchagan/zulip,andersk/zulip,timabbott/zulip,jackrzhang/zulip,rishig/zulip,brainwane/zulip,jackrzhang/zulip,kou/zulip,showell/zulip,zulip/zulip,hackerkid/zulip,jackrzhang/zulip,rht/zulip,punchagan/zulip,brainwane/zulip,synicalsyntax/zulip,rht/zulip,brainwane/zulip,rht/zulip,andersk/zulip,showell/zulip,eeshangarg/zulip,eeshangarg/zulip,jackrzhang/zulip,kou/zulip,shubhamdhama/zulip,shubhamdhama/zulip,brainwane/zulip,jackrzhang/zulip,kou/zulip,rishig/zulip,timabbott/zulip,rishig/zulip,andersk/zulip,timabbott/zulip,jackrzhang/zulip,kou/zulip,zulip/zulip,andersk/zulip,hackerkid/zulip,dhcrzf/zulip,showell/zulip,showell/zulip,rht/zulip,tommyip/zulip,andersk/zulip,synicalsyntax/zulip,showell/zulip,zulip/zulip,eeshangarg/zulip,timabbott/zulip,tommyip/zulip,timabbott/zulip,rishig/zulip,tommyip/zulip,rht/zulip,punchagan/zulip,hackerkid/zulip,tommyip/zulip,rht/zulip,shubhamdhama/zulip,zulip/zulip,kou/zulip,eeshangarg/zulip,eeshangarg/zulip,dhcrzf/zulip,jackrzhang/zulip,dhcrzf/zulip,synicalsyntax/zulip,dhcrzf/zulip,eeshangarg/zulip,rishig/zulip,rht/zulip,shubhamdhama/zulip,dhcrzf/zulip,tommyip/zulip,brainwane/zulip,synicalsyntax/zulip,rishig/zulip,kou/zulip,punchagan/zulip,synicalsyntax/zulip,punchagan/zulip,zulip/zulip,dhcrzf/zulip,eeshangarg/zulip