Skip to content

Commit 90e2bbe

Browse files
committed
Skip watchdog tests if watchdog is not installed
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
1 parent 17f5bf5 commit 90e2bbe

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

bpython/test/test_filewatch.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,29 @@
66
except ImportError:
77
import unittest
88

9-
from bpython.curtsiesfrontend.filewatch import ModuleChangedEventHandler
9+
try:
10+
from bpython.curtsiesfrontend.filewatch import ModuleChangedEventHandler
11+
has_watchdog = True
12+
except ImportError:
13+
has_watchdog = False
1014

15+
@unittest.skipIf(not has_watchdog, "watchdog not available")
1116
class TestModuleChangeEventHandler(unittest.TestCase):
12-
17+
1318
def setUp(self):
1419
self.module = ModuleChangedEventHandler([], 1)
1520
self.module.observer = mock.Mock()
16-
21+
1722
def test_create_module_handler(self):
1823
self.assertIsInstance(self.module, ModuleChangedEventHandler)
19-
24+
2025
def test_add_module(self):
2126
self.module._add_module('something/test.py')
22-
self.assertIn(os.path.abspath('something/test'),
27+
self.assertIn(os.path.abspath('something/test'),
2328
self.module.dirs[os.path.abspath('something')])
24-
29+
2530
def test_activate_throws_error_when_already_activated(self):
2631
self.module.activated = True
2732
with self.assertRaises(ValueError):
2833
self.module.activate()
29-
30-
34+

0 commit comments

Comments
 (0)