import pytest

pytest.importorskip("psutil")

def test_load_module():
    __import__("modules.core.cpu")


@@ -11,40 +11,343 @@
 est%0A
-%0Apytest.importorskip(%22psutil%22)%0A%0A
+from unittest import TestCase, mock%0A%0Aimport core.config%0Aimport core.widget%0Aimport modules.core.cpu%0A%0Apytest.importorskip(%22psutil%22)%0A%0Adef build_module():%0A    config = core.config.Config(%5B%5D)%0A    return modules.core.cpu.Module(config=config, theme=None)%0A%0Adef cpu_widget(module):%0A    return module.widgets()%5B0%5D%0A%0Aclass TestCPU(TestCase):%0A    
 def 
@@ -359,27 +359,35 @@
 load_module(
-):%0A
+self):%0A    
     __import
@@ -406,12 +406,1527 @@
 core.cpu%22)%0A%0A
+    @mock.patch('psutil.cpu_percent')%0A    def test_cpu_percent(self, cpu_percent_mock):%0A        cpu_percent_mock.return_value = 5%0A        module = build_module()%0A%0A        assert cpu_widget(module).full_text() == '5.0%25'%0A%0A    @mock.patch('psutil.cpu_percent')%0A    def test_cpu_percent_update(self, cpu_percent_mock):%0A        cpu_percent_mock.return_value = 10%0A        module = build_module()%0A%0A        assert cpu_widget(module).full_text() == '10.0%25'%0A%0A        cpu_percent_mock.return_value = 20%0A        module.update()%0A%0A        assert cpu_widget(module).full_text() == '20.0%25'%0A%0A    @mock.patch('psutil.cpu_percent')%0A    def test_healthy_state(self, cpu_percent_mock):%0A        cpu_percent_mock.return_value = 50%0A        module = build_module()%0A%0A        assert module.state(None) == None%0A%0A    @mock.patch('psutil.cpu_percent')%0A    def test_warning_state(self, cpu_percent_mock):%0A        cpu_percent_mock.return_value = 75%0A        module = build_module()%0A%0A        assert module.state(None) == 'warning'%0A%0A    @mock.patch('psutil.cpu_percent')%0A    def test_critical_state(self, cpu_percent_mock):%0A        cpu_percent_mock.return_value = 82%0A        module = build_module()%0A%0A        assert module.state(None) == 'critical'%0A%0A    @mock.patch('core.input.register')%0A    def test_register_left_mouse_action(self, input_register_mock):%0A        module = build_module()%0A%0A        input_register_mock.assert_called_with(%0A            module,%0A            button=core.input.LEFT_MOUSE,%0A            cmd='gnome-system-monitor'%0A        )%0A%0A%0A

Add CPU module tests