Refactor UnitTesting33 creation
This commit...
-
directly stores python 3.3 compat module's code in a string since sublime.load_resource() fails when called from plugin_loaded() in case reloading is triggered by removing UnitTesting from "ignored_packages".
We could also delay execution, but the simple and tiny module seems better placed in a string to avoid the API call during startup.
-
creates files only, if they don't already exist to avoid unnecessary reloading UnitTesting33/ut.py module during startup.
-
Catch OSErrors during file creation to avoid tracebacks.
sublime.load_resource() fails when called from plugin_loaded() in case reloading is triggered by removing UnitTesting from "ignored_packages"
First time I'm hearing of this. Isn't that a bug in ST? Do we have an issue for that?
As a very minor suggestion, you could create the three files in a function each and call them in a small for loop while catching the thrown exception there instead of catching three times.
Probably a ST bug as it is related with modified Preferences. It causes failures while enabling/disabling/upgrading packages via Package Control.
Of course we can add more syntactical sugar or even move whole py33 bootstrapping into a dedicated module. Just wrapped existing code into try..except as a quick solution as I want to keep focused on Package Control at this point.
Thanks for working on it.