OLD | NEW |
1 # Copyright 2014 Dirk Pranke. All rights reserved. | 1 # Copyright 2014 Dirk Pranke. All rights reserved. |
2 # | 2 # |
3 # Licensed under the Apache License, Version 2.0 (the "License"); | 3 # Licensed under the Apache License, Version 2.0 (the "License"); |
4 # you may not use this file except in compliance with the License. | 4 # you may not use this file except in compliance with the License. |
5 # You may obtain a copy of the License at | 5 # You may obtain a copy of the License at |
6 # | 6 # |
7 # http://www.apache.org/licenses/LICENSE-2.0 | 7 # http://www.apache.org/licenses/LICENSE-2.0 |
8 # | 8 # |
9 # Unless required by applicable law or agreed to in writing, software | 9 # Unless required by applicable law or agreed to in writing, software |
10 # distributed under the License is distributed on an "AS IS" BASIS, | 10 # distributed under the License is distributed on an "AS IS" BASIS, |
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 # See the License for the specific language governing permissions and | 12 # See the License for the specific language governing permissions and |
13 # limitations under the License. | 13 # limitations under the License. |
14 | 14 |
15 import io | 15 import io |
16 import json | 16 import json |
17 import os | 17 import os |
18 import sys | 18 import sys |
19 import textwrap | 19 import textwrap |
20 | 20 |
21 | |
22 from typ import main | 21 from typ import main |
23 from typ import test_case | 22 from typ import test_case |
24 from typ import Host | 23 from typ import Host |
25 from typ import VERSION | 24 from typ import VERSION |
26 from typ.fakes import test_result_server_fake | 25 from typ.fakes import test_result_server_fake |
27 | 26 |
28 | 27 |
29 is_python3 = bool(sys.version_info.major == 3) | 28 is_python3 = bool(sys.version_info.major == 3) |
30 | 29 |
31 if is_python3: # pragma: python3 | 30 if is_python3: # pragma: python3 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 pass | 134 pass |
136 """ | 135 """ |
137 | 136 |
138 | 137 |
139 SF_TEST_FILES = {'sf_test.py': SF_TEST_PY} | 138 SF_TEST_FILES = {'sf_test.py': SF_TEST_PY} |
140 | 139 |
141 | 140 |
142 LOAD_TEST_PY = """ | 141 LOAD_TEST_PY = """ |
143 import unittest | 142 import unittest |
144 | 143 |
| 144 |
145 class BaseTest(unittest.TestCase): | 145 class BaseTest(unittest.TestCase): |
146 pass | 146 pass |
147 | 147 |
| 148 |
148 def method_fail(self): | 149 def method_fail(self): |
149 self.fail() | 150 self.fail() |
150 | 151 |
| 152 |
151 def method_pass(self): | 153 def method_pass(self): |
152 pass | 154 pass |
153 | 155 |
| 156 |
154 def load_tests(_, _2, _3): | 157 def load_tests(_, _2, _3): |
155 setattr(BaseTest, "test_fail", method_fail) | 158 setattr(BaseTest, "test_fail", method_fail) |
156 setattr(BaseTest, "test_pass", method_pass) | 159 setattr(BaseTest, "test_pass", method_pass) |
157 suite = unittest.TestSuite() | 160 suite = unittest.TestSuite() |
158 suite.addTest(BaseTest("test_fail")) | 161 suite.addTest(BaseTest("test_fail")) |
159 suite.addTest(BaseTest("test_pass")) | 162 suite.addTest(BaseTest("test_pass")) |
160 return suite | 163 return suite |
161 """ | 164 """ |
162 | 165 |
163 LOAD_TEST_FILES = {'load_test.py': LOAD_TEST_PY} | 166 LOAD_TEST_FILES = {'load_test.py': LOAD_TEST_PY} |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
751 modules_to_unload.append(k) | 754 modules_to_unload.append(k) |
752 for k in modules_to_unload: | 755 for k in modules_to_unload: |
753 del sys.modules[k] | 756 del sys.modules[k] |
754 sys.path = orig_sys_path | 757 sys.path = orig_sys_path |
755 | 758 |
756 return ret, out, err | 759 return ret, out, err |
757 | 760 |
758 def test_debugger(self): | 761 def test_debugger(self): |
759 # TODO: this test seems to hang under coverage. | 762 # TODO: this test seems to hang under coverage. |
760 pass | 763 pass |
OLD | NEW |