You can try to use virsh.VirshConnectBack to implement this remote test. :)
Of course, your codes look good too. Just FYI.