Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions pythonFiles/completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ def _get_top_level_module(cls, path):
return path

def _generate_signature(self, completion):
"""Generate signature with function arguments.
"""
"""Generate signature with function arguments."""
if completion.type in ["module"] or not hasattr(completion, "params"):
return ""
return "%s(%s)" % (
Expand Down Expand Up @@ -551,8 +550,8 @@ def _set_request_config(self, config):

def _normalize_request_path(self, request):
"""Normalize any Windows paths received by a *nix build of
Python. Does not alter the reverse os.path.sep=='\\',
i.e. *nix paths received by a Windows build of Python.
Python. Does not alter the reverse os.path.sep=='\\',
i.e. *nix paths received by a Windows build of Python.
"""
if "path" in request:
if not self.drive_mount:
Expand All @@ -569,8 +568,7 @@ def _normalize_request_path(self, request):
request["path"] = newPath

def _process_request(self, request):
"""Accept serialized request from VSCode and write response.
"""
"""Accept serialized request from VSCode and write response."""
request = self._deserialize(request)

self._set_request_config(request.get("config", {}))
Expand Down
6 changes: 2 additions & 4 deletions pythonFiles/refactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ class ChangeType:


class Change:
"""
"""
""""""

EDIT = 0
NEW = 1
Expand Down Expand Up @@ -337,8 +336,7 @@ def _deserialize(self, request):
return json.loads(request)

def _process_request(self, request):
"""Accept serialized request from VSCode and write response.
"""
"""Accept serialized request from VSCode and write response."""
request = self._deserialize(request)
lookup = request.get("lookup", "")

Expand Down
3 changes: 2 additions & 1 deletion pythonFiles/tests/debug_adapter/test_install_debugpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ def _check_binaries(dir_path):


@pytest.mark.skipif(
sys.version_info[:2] != (3, 7), reason="DEBUGPY wheels shipped for Python 3.7 only",
sys.version_info[:2] != (3, 7),
reason="DEBUGPY wheels shipped for Python 3.7 only",
)
def test_install_debugpy(tmpdir):
import install_debugpy
Expand Down
5 changes: 4 additions & 1 deletion pythonFiles/tests/testing_tools/adapter/pytest/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ def test_discover(self):
add_subparser("discover", "pytest", subparsers)

self.assertEqual(
stub.calls, [("subparsers.add_parser", None, {"name": "pytest"}),]
stub.calls,
[
("subparsers.add_parser", None, {"name": "pytest"}),
],
)

def test_unsupported_command(self):
Expand Down
57 changes: 47 additions & 10 deletions pythonFiles/tests/testing_tools/adapter/pytest/test_discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,21 @@ def normcase(path):
raise NotImplementedError
##########
def _fix_fileid(*args):
return fix_fileid(*args, **dict(_normcase=normcase, _pathsep=pathsep,))
return fix_fileid(
*args,
**dict(
_normcase=normcase,
_pathsep=pathsep,
)
)

def _normalize_test_id(*args):
return pytest_item._normalize_test_id(
*args, **dict(_fix_fileid=_fix_fileid, _pathsep=pathsep,)
*args,
**dict(
_fix_fileid=_fix_fileid,
_pathsep=pathsep,
)
)

def _iter_nodes(*args):
Expand All @@ -205,20 +215,39 @@ def _iter_nodes(*args):
)

def _parse_node_id(*args):
return pytest_item._parse_node_id(*args, **dict(_iter_nodes=_iter_nodes,))
return pytest_item._parse_node_id(
*args,
**dict(
_iter_nodes=_iter_nodes,
)
)

##########
def _split_fspath(*args):
return pytest_item._split_fspath(*args, **dict(_normcase=normcase,))
return pytest_item._split_fspath(
*args,
**dict(
_normcase=normcase,
)
)

##########
def _matches_relfile(*args):
return pytest_item._matches_relfile(
*args, **dict(_normcase=normcase, _pathsep=pathsep,)
*args,
**dict(
_normcase=normcase,
_pathsep=pathsep,
)
)

def _is_legacy_wrapper(*args):
return pytest_item._is_legacy_wrapper(*args, **dict(_pathsep=pathsep,))
return pytest_item._is_legacy_wrapper(
*args,
**dict(
_pathsep=pathsep,
)
)

def _get_location(*args):
return pytest_item._get_location(
Expand Down Expand Up @@ -300,7 +329,9 @@ def test_failure(self):

self.assertEqual(
stub.calls,
[("pytest.main", None, {"args": self.DEFAULT_ARGS, "plugins": [plugin]}),],
[
("pytest.main", None, {"args": self.DEFAULT_ARGS, "plugins": [plugin]}),
],
)

def test_no_tests_found(self):
Expand Down Expand Up @@ -837,7 +868,9 @@ def test_doctest(self):
id="./x/y/z/test_eggs.py::test_eggs",
name="test_eggs",
path=TestPath(
root=testroot, relfile=fix_relpath(relfile), func=None,
root=testroot,
relfile=fix_relpath(relfile),
func=None,
),
source="{}:{}".format(fix_relpath(relfile), 1),
markers=[],
Expand All @@ -860,7 +893,9 @@ def test_doctest(self):
id="./x/y/z/test_eggs.py::test_eggs.TestSpam",
name="test_eggs.TestSpam",
path=TestPath(
root=testroot, relfile=fix_relpath(relfile), func=None,
root=testroot,
relfile=fix_relpath(relfile),
func=None,
),
source="{}:{}".format(fix_relpath(relfile), 13),
markers=[],
Expand All @@ -883,7 +918,9 @@ def test_doctest(self):
id="./x/y/z/test_eggs.py::test_eggs.TestSpam.TestEggs",
name="test_eggs.TestSpam.TestEggs",
path=TestPath(
root=testroot, relfile=fix_relpath(relfile), func=None,
root=testroot,
relfile=fix_relpath(relfile),
func=None,
),
source="{}:{}".format(fix_relpath(relfile), 28),
markers=[],
Expand Down
25 changes: 21 additions & 4 deletions pythonFiles/tests/testing_tools/adapter/test___main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@ def test_unsupported_command(self):

class ParseDiscoverTests(unittest.TestCase):
def test_pytest_default(self):
tool, cmd, args, toolargs = parse_args(["discover", "pytest",])
tool, cmd, args, toolargs = parse_args(
[
"discover",
"pytest",
]
)

self.assertEqual(tool, "pytest")
self.assertEqual(cmd, "discover")
Expand Down Expand Up @@ -88,7 +93,13 @@ def test_pytest_full(self):

def test_pytest_opts(self):
tool, cmd, args, toolargs = parse_args(
["discover", "pytest", "--simple", "--no-hide-stdio", "--pretty",]
[
"discover",
"pytest",
"--simple",
"--no-hide-stdio",
"--pretty",
]
)

self.assertEqual(tool, "pytest")
Expand Down Expand Up @@ -120,8 +131,14 @@ def test_discover(self):
"discover",
{"spam": "eggs"},
[],
_tools={tool.name: {"discover": tool.discover,}},
_reporters={"discover": reporter.report,},
_tools={
tool.name: {
"discover": tool.discover,
}
},
_reporters={
"discover": reporter.report,
},
)

self.assertEqual(
Expand Down
Loading