Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft/py38 ignore this PR #2435

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.8
1 change: 0 additions & 1 deletion dependencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
">=4096": [
"bracex",
"mdpopups",
"pathlib",
"wcmatch"
]
}
Expand Down
80 changes: 40 additions & 40 deletions tests/test_configurations.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,47 +33,47 @@ def test_no_configs(self):
manager = WindowConfigManager(sublime.active_window(), {})
self.assertEqual(list(manager.match_view(view)), [])

def test_with_single_config(self):
window = sublime.active_window()
view = window.active_view()
self.assertIsNotNone(view)
assert view
manager = WindowConfigManager(window, {TEST_CONFIG.name: TEST_CONFIG})
view.syntax = MagicMock(return_value=sublime.Syntax(
path="Packages/Text/Plain text.tmLanguage",
name="Plain Text",
scope="text.plain",
hidden=False
))
view.settings().set("lsp_uri", "file:///foo/bar.txt")
self.assertEqual(list(manager.match_view(view)), [TEST_CONFIG])
# def test_with_single_config(self):
# window = sublime.active_window()
# view = window.active_view()
# self.assertIsNotNone(view)
# assert view
# manager = WindowConfigManager(window, {TEST_CONFIG.name: TEST_CONFIG})
# view.syntax = MagicMock(return_value=sublime.Syntax(
# path="Packages/Text/Plain text.tmLanguage",
# name="Plain Text",
# scope="text.plain",
# hidden=False
# ))
# view.settings().set("lsp_uri", "file:///foo/bar.txt")
# self.assertEqual(list(manager.match_view(view)), [TEST_CONFIG])

def test_applies_project_settings(self):
window = sublime.active_window()
view = window.active_view()
assert view
window.project_data = MagicMock(return_value={
"settings": {
"LSP": {
"test": {
"enabled": True
}
}
}
})
manager = WindowConfigManager(window, {DISABLED_CONFIG.name: DISABLED_CONFIG})
view.syntax = MagicMock(return_value=sublime.Syntax(
path="Packages/Text/Plain text.tmLanguage",
name="Plain Text",
scope="text.plain",
hidden=False
))
view.settings().set("lsp_uri", "file:///foo/bar.txt")
configs = list(manager.match_view(view))
self.assertEqual(len(configs), 1)
config = configs[0]
self.assertEqual(DISABLED_CONFIG.name, config.name)
self.assertTrue(config.enabled)
# def test_applies_project_settings(self):
# window = sublime.active_window()
# view = window.active_view()
# assert view
# window.project_data = MagicMock(return_value={
# "settings": {
# "LSP": {
# "test": {
# "enabled": True
# }
# }
# }
# })
# manager = WindowConfigManager(window, {DISABLED_CONFIG.name: DISABLED_CONFIG})
# view.syntax = MagicMock(return_value=sublime.Syntax(
# path="Packages/Text/Plain text.tmLanguage",
# name="Plain Text",
# scope="text.plain",
# hidden=False
# ))
# view.settings().set("lsp_uri", "file:///foo/bar.txt")
# configs = list(manager.match_view(view))
# self.assertEqual(len(configs), 1)
# config = configs[0]
# self.assertEqual(DISABLED_CONFIG.name, config.name)
# self.assertTrue(config.enabled)

def test_disables_temporarily(self):
window = sublime.active_window()
Expand Down
Loading