def test_vm_cputime(self):
        ret = {'1': {'cputime_percent': 0, 'cputime': 1}}
        with patch.object(xapi, "_get_xapi_session", MagicMock()):
            mock = MagicMock(return_value={'host_CPUs': "1"})
            with patch.object(xapi, "_get_record_by_label", mock):
                mock = MagicMock(return_value={'VCPUs_number': "1",
                                               'VCPUs_utilisation': {'0': '1'}}
                                 )
                with patch.object(xapi, "_get_metrics_record", mock):
                    self.assertDictEqual(xapi.vm_cputime("1"), ret)

            mock = MagicMock(return_value={})
            with patch.object(xapi, "list_domains", mock):
                self.assertDictEqual(xapi.vm_cputime(""), {})
Wait for all our threads to finish
dataset/ETHPy150Open saltstack/salt/tests/unit/modules/xapi_test.py/XapiTestCase.test_vm_cputime--crossover with--dataset/ETHPy150Open ganeti/ganeti/test/py/ganeti.locking_unittest.py/_ThreadedTestCase._waitThreads