Structure tests.
@@ -175,26 +175,30 @@ def assertEqual(v1, v2):
if v1 != v2:
raise Exception('Assertion failed, {} == {}'.format(v1, v2))
-def test_LanguageClient():
+class TestLanguageClient():
+ @classmethod
+ def setup_class(cls):
nvim = neovim.attach('child', argv=['/usr/bin/env', 'nvim', '--embed'])
- client = LanguageClient(nvim)
+ cls.client = LanguageClient(nvim)
+ def test_initialize(self):
# initialize
- client.initialize("/private/tmp/sample-rs")
- while len(client.queue) > 0:
+ self.client.initialize("/private/tmp/sample-rs")
+ while len(self.client.queue) > 0:
time.sleep(0.1)
## wait for notification
# time.sleep(300)
+ def test_textDocument_hover(self):
# textDocument/didOpen
- client.textDocument_didOpen("/private/tmp/sample-rs/src/main.rs")
+ self.client.textDocument_didOpen("/private/tmp/sample-rs/src/main.rs")
time.sleep(3)
# textDocument/hover
- client.textDocument_hover("/private/tmp/sample-rs/src/main.rs", 8, 22,
+ self.client.textDocument_hover("/private/tmp/sample-rs/src/main.rs", 8, 22,
lambda value: assertEqual(value, 'fn () -> i32'))
- while len(client.queue) > 0:
+ while len(self.client.queue) > 0:
time.sleep(0.1)
