def test_thread_result_is_returned(self): """ Test that an error raised by check_cgroup_availability is correctly re-raised in the main thread by replacing this function temporarily. """ tmp = check_cgroups.check_cgroup_availability try: check_cgroups.check_cgroup_availability = lambda wait: exit(1) with self.assertRaises(SystemExit): check_cgroups.main([]) finally: check_cgroups.check_cgroup_availability = tmp
def test_thread_result_is_returned(self): """ Test that an error raised by check_cgroup_availability is correctly re-raised in the main thread by replacing this function temporarily. """ tmp = check_cgroups.check_cgroup_availability try: check_cgroups.check_cgroup_availability = lambda wait : exit(1) with self.assertRaises(SystemExit): check_cgroups.main([]) finally: check_cgroups.check_cgroup_availability = tmp
def test_threaded(self): try: check_cgroups.main([]) except SystemExit as e: # expected if cgroups are not available self.skipTest(e)
def test_simple(self): try: check_cgroups.main(['--no-thread']) except SystemExit as e: # expected if cgroups are not available self.skipTest(e)