diff --git a/tests/core/test_theme.py b/tests/core/test_theme.py index 46f91d2..1865992 100644 --- a/tests/core/test_theme.py +++ b/tests/core/test_theme.py @@ -85,21 +85,26 @@ class theme(unittest.TestCase): def test_wal_colors(self): with unittest.mock.patch('core.theme.io') as io: - io.open.return_value.__enter__.return_value.read.return_value=''' - { "colors": { "red": "#ff0000" } } - ''' + with unittest.mock.patch('core.theme.os') as os: + os.path.isfile.return_value = True + io.open.return_value = unittest.mock.MagicMock() + io.open.return_value.__enter__.return_value.read.return_value=''' + { "colors": { "red": "#ff0000" } } + ''' - theme = core.theme.Theme(raw_data=self.walTheme) - self.assertEqual({'red': '#ff0000'}, theme.keywords()) + theme = core.theme.Theme(raw_data=self.walTheme) + self.assertEqual({'red': '#ff0000'}, theme.keywords()) def test_wal_special(self): with unittest.mock.patch('core.theme.io') as io: - io.open.return_value.__enter__.return_value.read.return_value=''' - { "special": { "background": "#ff0000" } } - ''' + with unittest.mock.patch('core.theme.os') as os: + os.path.isfile.return_value = True + io.open.return_value.__enter__.return_value.read.return_value=''' + { "special": { "background": "#ff0000" } } + ''' - theme = core.theme.Theme(raw_data=self.walTheme) - self.assertEqual({'background': '#ff0000'}, theme.keywords()) + theme = core.theme.Theme(raw_data=self.walTheme) + self.assertEqual({'background': '#ff0000'}, theme.keywords()) def test_cycle_value(self): widget = core.widget.Widget()