Skip to content

Commit c39c871

Browse files
committed
better catch changes
1 parent 6538079 commit c39c871

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

unittesting/helpers/override_preferences_test_cast.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,22 @@ def setUpClass(cls):
1515
for settings_file_name, settings in cls.override_preferences.items():
1616
settings_path = os.path.join(sublime.packages_path(), "User", settings_file_name)
1717
new_settings_path = settings_path + ".bak"
18-
if os.path.exists(settings_path):
19-
shutil.move(settings_path, new_settings_path)
2018

2119
s = sublime.load_settings(settings_file_name)
2220
on_change_key = settings_file_name + "catch_on_change"
2321
caught = [False]
2422
s.add_on_change(on_change_key, lambda: caught.__setitem__(0, True))
23+
24+
if os.path.exists(settings_path):
25+
shutil.move(settings_path, new_settings_path)
26+
yield lambda: caught[0]
27+
yield 500
28+
29+
caught = [False]
2530
with open(settings_path, "w") as f:
2631
f.write(json.dumps(settings))
2732
yield lambda: caught[0]
33+
yield 500
2834
s.clear_on_change(on_change_key)
2935

3036
@classmethod

0 commit comments

Comments
 (0)