GeezerVison is showing github.com — Testing tools adapter py2 (#4646) · gaurav131/pythonVSCode@86a2e56
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: build/ci/templates/compile-and-validate.yml +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -156,7 +156,7 @@ jobs: | 156 | 156 | arguments: '-m pip install --upgrade -r ./build/test-requirements.txt' | 157 | 157 |
| 158 | 158 |
| 159 | | - - bash: 'python -m pythonFiles.tests' | | 159 | + - bash: 'python pythonFiles/tests/run_all.py' | 160 | 160 | displayName: 'run pythonFiles unit tests' | 161 | 161 |
| 162 | 162 |
| |
Collapse file Copy file name to clipboardExpand all lines: pythonFiles/testing_tools/__init__.py Collapse file Copy file name to clipboard +4-2Lines changed: 4 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 |
| 2 | 2 | class UnsupportedToolError(ValueError): | 3 | 3 | def __init__(self, tool): | 4 | | - super().__init__('unsupported tool {!r}'.format(tool)) | | 4 | + msg = 'unsupported tool {!r}'.format(tool) | | 5 | + super(UnsupportedToolError, self).__init__(msg) | 5 | 6 | self.tool = tool | 6 | 7 |
| 7 | 8 |
| 8 | 9 | class UnsupportedCommandError(ValueError): | 9 | 10 | def __init__(self, cmd): | 10 | | - super().__init__('unsupported cmd {!r}'.format(cmd)) | | 11 | + msg = 'unsupported cmd {!r}'.format(cmd) | | 12 | + super(UnsupportedCommandError, self).__init__(msg) | 11 | 13 | self.cmd = cmd |
Collapse file Copy file name to clipboardExpand all lines: pythonFiles/testing_tools/adapter/pytest.py +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +from __future__ import absolute_import | | 2 | + | 1 | 3 | import os.path | 2 | 4 |
| 3 | 5 | import pytest | |
Collapse file Copy file name to clipboardExpand all lines: pythonFiles/testing_tools/adapter/report.py +3-1Lines changed: 3 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +from __future__ import print_function | | 2 | + | 1 | 3 | import json | 2 | 4 |
| 3 | 5 |
| 4 | 6 | def report_discovered(tests, debug=False, | 5 | | - _send=print): | | 7 | + _send=print): | 6 | 8 | """Serialize the discovered tests and write to stdout.""" | 7 | 9 | data = [{ | 8 | 10 | 'id': test.id, | |
Collapse file Copy file name to clipboardExpand all lines: pythonFiles/tests/__main__.py +7-2Lines changed: 7 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 10 | 10 | TESTING_TOOLS_ROOT = os.path.join(SRC_ROOT, 'testing_tools') | 11 | 11 |
| 12 | 12 |
| 13 | | -if __name__ == '__main__': | | 13 | +def main(argv=sys.argv[1:]): | 14 | 14 | sys.path.insert(1, DATASCIENCE_ROOT) | 15 | 15 | sys.path.insert(1, TESTING_TOOLS_ROOT) | 16 | 16 | ec = pytest.main([ | 17 | 17 | '--rootdir', SRC_ROOT, | 18 | 18 | TEST_ROOT, | 19 | | - ] + sys.argv[1:]) | | 19 | + ] + argv) | | 20 | + return ec | | 21 | + | | 22 | + | | 23 | +if __name__ == '__main__': | | 24 | + ec = main() | 20 | 25 | sys.exit(ec) |
Collapse file Copy file name to clipboard +13Lines changed: 13 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +# Replace the "." entry. | | 2 | +import os.path | | 3 | +import sys | | 4 | +sys.path[0] = os.path.dirname( | | 5 | + os.path.dirname( | | 6 | + os.path.abspath(__file__))) | | 7 | + | | 8 | +from tests.__main__ import main | | 9 | + | | 10 | + | | 11 | +if __name__ == '__main__': | | 12 | + ec = main() | | 13 | + sys.exit(ec) |
Collapse file Copy file name to clipboardExpand all lines: pythonFiles/tests/testing_tools/adapter/test___main__.py +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 9 | 9 | class StubTool(StubProxy): | 10 | 10 |
| 11 | 11 | def __init__(self, name, stub=None): | 12 | | - super().__init__(stub, name) | | 12 | + super(StubTool, self).__init__(stub, name) | 13 | 13 | self.return_discover = None | 14 | 14 |
| 15 | 15 | def discover(self, args, **kwargs): | @@ -22,7 +22,7 @@ def discover(self, args, **kwargs): | 22 | 22 | class StubReporter(StubProxy): | 23 | 23 |
| 24 | 24 | def __init__(self, stub=None): | 25 | | - super().__init__(stub, 'reporter') | | 25 | + super(StubReporter, self).__init__(stub, 'reporter') | 26 | 26 |
| 27 | 27 | def report(self, discovered, **kwargs): | 28 | 28 | self.add_call('report', (discovered,), kwargs or None) | |
Collapse file Copy file name to clipboardExpand all lines: pythonFiles/tests/testing_tools/adapter/test_pytest.py +7-7Lines changed: 7 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 12 | 12 | class StubSubparsers(StubProxy): | 13 | 13 |
| 14 | 14 | def __init__(self, stub=None, name='subparsers'): | 15 | | - super().__init__(stub, name) | | 15 | + super(StubSubparsers, self).__init__(stub, name) | 16 | 16 |
| 17 | 17 | def add_parser(self, name): | 18 | 18 | self.add_call('add_parser', None, {'name': name}) | @@ -22,7 +22,7 @@ def add_parser(self, name): | 22 | 22 | class StubArgParser(StubProxy): | 23 | 23 |
| 24 | 24 | def __init__(self, stub=None): | 25 | | - super().__init__(stub, 'argparser') | | 25 | + super(StubArgParser, self).__init__(stub, 'argparser') | 26 | 26 |
| 27 | 27 | def add_argument(self, *args, **kwargs): | 28 | 28 | self.add_call('add_argument', args, kwargs) | @@ -31,7 +31,7 @@ def add_argument(self, *args, **kwargs): | 31 | 31 | class StubPyTest(StubProxy): | 32 | 32 |
| 33 | 33 | def __init__(self, stub=None): | 34 | | - super().__init__(stub, 'pytest') | | 34 | + super(StubPyTest, self).__init__(stub, 'pytest') | 35 | 35 | self.return_main = 0 | 36 | 36 |
| 37 | 37 | def main(self, args, plugins): | @@ -42,7 +42,7 @@ def main(self, args, plugins): | 42 | 42 | class StubPlugin(StubProxy): | 43 | 43 |
| 44 | 44 | def __init__(self, stub=None): | 45 | | - super().__init__(stub, 'plugin') | | 45 | + super(StubPlugin, self).__init__(stub, 'plugin') | 46 | 46 |
| 47 | 47 | def __getattr__(self, name): | 48 | 48 | if not name.startswith('pytest_'): | @@ -67,7 +67,7 @@ def __init__(self, name): | 67 | 67 | class StubPytestItem(StubProxy): | 68 | 68 |
| 69 | 69 | def __init__(self, stub=None, **attrs): | 70 | | - super().__init__(stub, 'pytest.Item') | | 70 | + super(StubPytestItem, self).__init__(stub, 'pytest.Item') | 71 | 71 | self.__dict__.update(attrs) | 72 | 72 | if 'own_markers' not in attrs: | 73 | 73 | self.own_markers = () | @@ -82,7 +82,7 @@ def func(*args, **kwargs): | 82 | 82 | class StubPytestSession(StubProxy): | 83 | 83 |
| 84 | 84 | def __init__(self, stub=None): | 85 | | - super().__init__(stub, 'pytest.Session') | | 85 | + super(StubPytestSession, self).__init__(stub, 'pytest.Session') | 86 | 86 |
| 87 | 87 | def __getattr__(self, name): | 88 | 88 | self.add_call(name + ' (attr)', None, None) | @@ -94,7 +94,7 @@ def func(*args, **kwargs): | 94 | 94 | class StubPytestConfig(StubProxy): | 95 | 95 |
| 96 | 96 | def __init__(self, stub=None): | 97 | | - super().__init__(stub, 'pytest.Config') | | 97 | + super(StubPytestConfig, self).__init__(stub, 'pytest.Config') | 98 | 98 |
| 99 | 99 | def __getattr__(self, name): | 100 | 100 | self.add_call(name + ' (attr)', None, None) | |
|