-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_python_tests.py
37 lines (27 loc) · 1.12 KB
/
run_python_tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
"""
run_python_tests.py: Run the Python test nearest to the cursor.
The test is launched in an external shell, such as iTerm, Terminal.app or
Konsole.
This code is licensed under the MIT license and copyright (c) Andrew Brookins
<a.m.brookins@gmail.com>.
"""
import settings
import sublime_plugin
import util
class PythonTestCommandBase(sublime_plugin.TextCommand):
def _run(self, edit, target):
mode = self.view.settings().get(settings.TEST_MODE, 'django')
terminal = self.view.settings().get(settings.TEST_TERMINAL_SETTING, None)
test_command = util.get_test_command(
mode, self.view.settings(), self.view.file_name())
test_name = util.get_test_name(self.view, mode, target=target)
util.run_test_command(test_command, test_name, terminal)
class RunPythonTestSuiteCommand(PythonTestCommandBase):
def run(self, edit):
self._run(edit, 'suite')
class RunPythonTestClassCommand(PythonTestCommandBase):
def run(self, edit):
self._run(edit, 'class')
class RunPythonTestMethodCommand(PythonTestCommandBase):
def run(self, edit):
self._run(edit, 'method')