re: testing out the function, you can set up test suites which run only on reload as so:
[pre=#0C1021]##################################### TESTS ####################################
import unittest
class GetPackageAssetTests(unittest.TestCase):
def test_get_package_and_asset_name(self):
tc = get_package_and_asset_name
aseq = self.assertEquals
r1 = (tc("Packages/Relative/one.py"))
r2 = (tc("/Abs/Packages/ZipPseudo.sublime-package/nested/sort.py"))
r3 = (tc(sublime.packages_path() + "/Absolute/Nested/asset.pth"))
aseq(r1, ('Relative', 'one.py'))
aseq(r2, ('ZipPseudo', 'nested/sort.py'))
aseq(r3, ('Absolute', 'Nested/asset.pth'))
################ ONLY LOAD TESTS WHEN DEVELOPING NOT ON START UP ###############
try: times_module_has_been_reloaded += 1
except NameError: times_module_has_been_reloaded = 0 #reloaded
if times_module_has_been_reloaded:
target = name
suite = unittest.TestLoader().loadTestsFromName(target)
unittest.TextTestRunner(stream = sys.stdout, verbosity=0).run(suite)
print ("running tests", target)
print ('\nReloads: %s' % times_module_has_been_reloaded)
################################################################################
[/pre]