UnitTesting icon indicating copy to clipboard operation
UnitTesting copied to clipboard

Refactor UnitTesting33 creation

Open deathaxe opened this issue 3 years ago • 3 comments

This commit...

  1. 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.

  2. creates files only, if they don't already exist to avoid unnecessary reloading UnitTesting33/ut.py module during startup.

  3. Catch OSErrors during file creation to avoid tracebacks.

deathaxe avatar Sep 06 '22 08:09 deathaxe

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.

FichteFoll avatar Sep 06 '22 17:09 FichteFoll

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.

deathaxe avatar Sep 07 '22 07:09 deathaxe

Thanks for working on it.

randy3k avatar Sep 09 '22 18:09 randy3k