Skip to content

Commit 1ea635c

Browse files
predragnikolicrchldeathaxerwolsPredrag
authored
Switch to python 3.8 (#2418)
* "Add .python-version file" * remove pathlib from dependencies * change import * Revert "change import" (: This reverts commit c70cd57. * Fix failing unittests on MacOS (#2436) This commit adopts `unittesting.ViewTestCase` to run view related test cases. ViewTestCase ... 1. provides `view` and `window` members pointing to a dedicated view, being created for testing. 2. ensures not to close empty windows, which was probably the most likely reason for unittests failing before on MacOS. * keep the same order as before * rchlint * add release notes * tweak release message * Be more descriptive of what the user expect, or what the user can do if things go wrong * tweak words * fix typos --------- Co-authored-by: Rafal Chlodnicki <[email protected]> Co-authored-by: deathaxe <[email protected]> Co-authored-by: Raoul Wols <[email protected]> Co-authored-by: Predrag <[email protected]>
1 parent ec16d95 commit 1ea635c

File tree

6 files changed

+56
-32
lines changed

6 files changed

+56
-32
lines changed

.github/workflows/main.yml

-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ jobs:
2424
runs-on: ${{ matrix.os }}
2525
steps:
2626
- uses: actions/checkout@v4
27-
- if: ${{ matrix.os == 'macOS-latest' }}
28-
run: brew unlink openssl
2927
- uses: SublimeText/UnitTesting/actions/setup@v1
3028
- uses: SublimeText/UnitTesting/actions/run-tests@v1
3129
with:

.python-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.8

dependencies.json

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
">=4096": [
44
"bracex",
55
"mdpopups",
6-
"pathlib",
76
"wcmatch"
87
]
98
}

messages.json

+1
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,6 @@
3737
"1.7.0": "messages/1.7.0.txt",
3838
"1.8.0": "messages/1.8.0.txt",
3939
"1.9.0": "messages/1.9.0.txt",
40+
"2.0.0": "messages/2.0.0.txt",
4041
"install": "messages/install.txt"
4142
}

messages/2.0.0.txt

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
=> 2.0.0
2+
3+
⚠️ Sublime Text will need to be restarted **more than once** for things to work properly. ⚠️
4+
5+
# Breaking changes
6+
7+
- LSP and LSP-* packages are transitioning from Python 3.3 to Python 3.8.
8+
9+
# FAQ
10+
11+
### What are the most significant improvements that stem from the 3.3 to 3.8 change?
12+
13+
There are no new features.
14+
This is an internal LSP codebase change that affects all LSP-* packages.
15+
16+
### LSP is broken after the update even if Sublime Text is restarted many times
17+
18+
If that is the case, follow these steps:
19+
20+
- ##### Check if `"index_files"` is set to `false` in `Preferences.sublime-settings`
21+
22+
From the command palette open `Preferences: Settings` and see if `"index_files": false` exists.
23+
If yes, remove that setting.
24+
25+
- ##### Check if `"LSP"` is put in `"ignored_packages"` in `Preferences.sublime-settings`
26+
27+
Ensure that LSP hasn't been added to the "ignored_packages" list during the update. If it has, remove it.
28+
29+
- ##### Reach for help
30+
31+
Feel free to [open an issue](https://github.com/sublimelsp/LSP/issues/new?assignees=&labels=&projects=&template=bug_report.md&title=) or reach out to us on [Discord](https://discord.gg/TZ5WN8t) if you encounter any problems during the update.
32+
Please provide logs from the Sublime Text console.

tests/test_configurations.py

+22-29
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
from LSP.plugin.core.configurations import WindowConfigManager
22
from test_mocks import DISABLED_CONFIG
33
from test_mocks import TEST_CONFIG
4+
from unittest import TestCase
45
from unittest.mock import MagicMock
6+
from unittesting import ViewTestCase
57
import sublime
6-
import unittest
78

89

9-
class GlobalConfigManagerTests(unittest.TestCase):
10+
class GlobalConfigManagerTests(TestCase):
1011

1112
def test_empty_configs(self):
1213
window_mgr = WindowConfigManager(sublime.active_window(), {})
@@ -24,35 +25,29 @@ def test_override_config(self):
2425
self.assertFalse(list(window_mgr.all.values())[0].enabled)
2526

2627

27-
class WindowConfigManagerTests(unittest.TestCase):
28+
class WindowConfigManagerTests(ViewTestCase):
2829

2930
def test_no_configs(self):
30-
view = sublime.active_window().active_view()
31-
self.assertIsNotNone(view)
32-
assert view
33-
manager = WindowConfigManager(sublime.active_window(), {})
34-
self.assertEqual(list(manager.match_view(view)), [])
31+
self.assertIsNotNone(self.view)
32+
self.assertIsNotNone(self.window)
33+
manager = WindowConfigManager(self.window, {})
34+
self.assertEqual(list(manager.match_view(self.view)), [])
3535

3636
def test_with_single_config(self):
37-
window = sublime.active_window()
38-
view = window.active_view()
39-
self.assertIsNotNone(view)
40-
assert view
41-
manager = WindowConfigManager(window, {TEST_CONFIG.name: TEST_CONFIG})
42-
view.syntax = MagicMock(return_value=sublime.Syntax(
37+
self.assertIsNotNone(self.view)
38+
self.assertIsNotNone(self.window)
39+
manager = WindowConfigManager(self.window, {TEST_CONFIG.name: TEST_CONFIG})
40+
self.view.syntax = MagicMock(return_value=sublime.Syntax(
4341
path="Packages/Text/Plain text.tmLanguage",
4442
name="Plain Text",
4543
scope="text.plain",
4644
hidden=False
4745
))
48-
view.settings().set("lsp_uri", "file:///foo/bar.txt")
49-
self.assertEqual(list(manager.match_view(view)), [TEST_CONFIG])
46+
self.view.settings().set("lsp_uri", "file:///foo/bar.txt")
47+
self.assertEqual(list(manager.match_view(self.view)), [TEST_CONFIG])
5048

5149
def test_applies_project_settings(self):
52-
window = sublime.active_window()
53-
view = window.active_view()
54-
assert view
55-
window.project_data = MagicMock(return_value={
50+
self.window.project_data = MagicMock(return_value={
5651
"settings": {
5752
"LSP": {
5853
"test": {
@@ -61,24 +56,22 @@ def test_applies_project_settings(self):
6156
}
6257
}
6358
})
64-
manager = WindowConfigManager(window, {DISABLED_CONFIG.name: DISABLED_CONFIG})
65-
view.syntax = MagicMock(return_value=sublime.Syntax(
59+
manager = WindowConfigManager(self.window, {DISABLED_CONFIG.name: DISABLED_CONFIG})
60+
self.view.syntax = MagicMock(return_value=sublime.Syntax(
6661
path="Packages/Text/Plain text.tmLanguage",
6762
name="Plain Text",
6863
scope="text.plain",
6964
hidden=False
7065
))
71-
view.settings().set("lsp_uri", "file:///foo/bar.txt")
72-
configs = list(manager.match_view(view))
66+
self.view.settings().set("lsp_uri", "file:///foo/bar.txt")
67+
configs = list(manager.match_view(self.view))
7368
self.assertEqual(len(configs), 1)
7469
config = configs[0]
7570
self.assertEqual(DISABLED_CONFIG.name, config.name)
7671
self.assertTrue(config.enabled)
7772

7873
def test_disables_temporarily(self):
79-
window = sublime.active_window()
80-
view = window.active_view()
81-
window.project_data = MagicMock(return_value={
74+
self.window.project_data = MagicMock(return_value={
8275
"settings": {
8376
"LSP": {
8477
"test": {
@@ -88,7 +81,7 @@ def test_disables_temporarily(self):
8881
}
8982
})
9083

91-
manager = WindowConfigManager(window, {DISABLED_CONFIG.name: DISABLED_CONFIG})
84+
manager = WindowConfigManager(self.window, {DISABLED_CONFIG.name: DISABLED_CONFIG})
9285
# disables config in-memory
9386
manager.disable_config(DISABLED_CONFIG.name, only_for_session=True)
94-
self.assertFalse(any(manager.match_view(view)))
87+
self.assertFalse(any(manager.match_view(self.view)))

0 commit comments

Comments
 (0)