Use with-clear-commands

Any tests that modify the command state should be wrapped in with-clear-commands so that they clean up after themselves.