forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unittest for large workspaces (#21351)
follows the same steps as making pytest compatible with large workspaces with many tests. Now test_ids are sent over a port as a json instead of in the exec function which can hit a cap on # of characters. Should fix #21339.
- Loading branch information
1 parent
f0d87d1
commit 29fa3fc
Showing
11 changed files
with
287 additions
and
190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. | ||
import io | ||
import json | ||
from typing import List | ||
|
||
CONTENT_LENGTH: str = "Content-Length:" | ||
|
||
|
||
def process_rpc_json(data: str) -> List[str]: | ||
"""Process the JSON data which comes from the server.""" | ||
str_stream: io.StringIO = io.StringIO(data) | ||
|
||
length: int = 0 | ||
|
||
while True: | ||
line: str = str_stream.readline() | ||
if CONTENT_LENGTH.lower() in line.lower(): | ||
length = int(line[len(CONTENT_LENGTH) :]) | ||
break | ||
|
||
if not line or line.isspace(): | ||
raise ValueError("Header does not contain Content-Length") | ||
|
||
while True: | ||
line: str = str_stream.readline() | ||
if not line or line.isspace(): | ||
break | ||
|
||
raw_json: str = str_stream.read(length) | ||
return json.loads(raw_json) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.