├── __init__.py ├── remotely_run_python_test.sublime-settings ├── README.md ├── remotely_run_python_test.py └── Main.sublime-menu /__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /remotely_run_python_test.sublime-settings: -------------------------------------------------------------------------------- 1 | { 2 | "cmd": "", 3 | "path": "" 4 | } 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | RemotelyRunPythonTests 2 | ============== 3 | 4 | Installation: 5 | =========== 6 | 7 | go to `~/Library/Application\ Support/Sublime\ Text\ 3/Packages` 8 | 9 | `git clone git@github.com:gs/RemotelyRunPythonTests.git` 10 | 11 | Setup 12 | ===== 13 | In Package Settings you can specify settings as follows: 14 | 15 | `{ 16 | "cmd": "ssh dev 'cd ~/path-to-code; testify '", 17 | "path": "/Users/path-to-your-code-folder/" 18 | }` 19 | 20 | 21 | 22 | add keybinding: 23 | 24 | ` { "keys": ["super+shift+r", "y"], "command": "remotely_run_python_test" } ` 25 | -------------------------------------------------------------------------------- /remotely_run_python_test.py: -------------------------------------------------------------------------------- 1 | import sublime 2 | import sublime_plugin 3 | import re 4 | 5 | class RemotelyRunPythonTest(sublime_plugin.WindowCommand): 6 | def run(self): 7 | path, cmnd = self.settings() 8 | file_name = self.window.active_view().file_name().replace(str(path), '') 9 | if re.search('_test.py', file_name): 10 | self.window.run_command('exec', {'cmd': [cmnd + file_name], 'shell':True} ) 11 | else: 12 | sublime.error_message("Wtf? Is this a test file?!") 13 | 14 | def settings(self): 15 | settings = sublime.load_settings("remotely_run_python_test.sublime-settings") 16 | path = settings.get("path") 17 | cmd = settings.get("cmd") 18 | if (path == "") or (cmd == ""): 19 | sublime.error_message("Please define 'cmd' and 'path' in remotely_run_python_test.sublime-settings") 20 | else: 21 | return [path, cmd] -------------------------------------------------------------------------------- /Main.sublime-menu: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "caption": "Preferences", 4 | "mnemonic": "n", 5 | "id": "preferences", 6 | "children": [ 7 | { 8 | "caption": "Package Settings", 9 | "mnemonic": "P", 10 | "id": "package-settings", 11 | "children": [ 12 | { 13 | "caption": "RemotelyRunPythonTests", 14 | "children": [ 15 | { 16 | "command": "open_file", 17 | "args": {"file": "${packages}/RemotelyRunPythonTests/remotely_run_python_test.sublime-settings"}, 18 | "caption": "Settings - Default" 19 | }, 20 | { 21 | "command": "open_file", 22 | "args": {"file": "${packages}/User/remotely_run_python_test.sublime-settings"}, 23 | "caption": "Settings - User" 24 | } 25 | ] 26 | } 27 | ] 28 | } 29 | ] 30 | } 31 | ] 32 | --------------------------------------------------------------------------------