Thread test fix with python-yaml is not present

On some system python-yaml might not be available which means that some test steps are skipped. If a file is created during such test step, it will not be created if the prerequisite are not fulfilled.
Those commits fixes the situation in thread command unit tests.