Skip to content

Commit 17e825d

Browse files
committed
fix on adding limit
1 parent 056c197 commit 17e825d

File tree

4 files changed

+127
-9
lines changed

4 files changed

+127
-9
lines changed

python_files/unittestadapter/pvsc_utils.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ def send_post_request(
329329

330330
if __writer is None:
331331
try:
332-
__writer = open(test_run_pipe, "w", encoding="utf-8", newline="\r\n") # noqa: SIM115, PTH123
332+
__writer = open(test_run_pipe, "wb") # noqa: SIM115, PTH123
333333
except Exception as error:
334334
error_msg = f"Error attempting to connect to extension named pipe {test_run_pipe}[vscode-unittest]: {error}"
335335
print(error_msg, file=sys.stderr)
@@ -343,9 +343,17 @@ def send_post_request(
343343
data = json.dumps(rpc)
344344
try:
345345
if __writer:
346-
request = f"""content-length: {len(data)}\ncontent-type: application/json\n\n{data}"""
347-
__writer.write(request)
348-
__writer.flush()
346+
request = (
347+
f"""content-length: {len(data)}\r\ncontent-type: application/json\r\n\r\n{data}"""
348+
)
349+
size = 4096
350+
encoded = request.encode("utf-8")
351+
bytes_written = 0
352+
while bytes_written < len(encoded):
353+
print("writing more bytes!")
354+
segment = encoded[bytes_written : bytes_written + size]
355+
bytes_written += __writer.write(segment)
356+
__writer.flush()
349357
else:
350358
print(
351359
f"Connection error[vscode-unittest], writer is None \n[vscode-unittest] data: \n{data} \n",

python_files/vscode_pytest/__init__.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -923,7 +923,8 @@ def send_message(
923923

924924
if __writer is None:
925925
try:
926-
__writer = open(TEST_RUN_PIPE, "w", encoding="utf-8", newline="\r\n") # noqa: SIM115, PTH123
926+
# option B: put this there: , buffering=1024
927+
__writer = open(TEST_RUN_PIPE, "wb") # noqa: SIM115, PTH123 (-1 no ,0 auto,1, int [this is the value of the buffer size])
927928
except Exception as error:
928929
error_msg = f"Error attempting to connect to extension named pipe {TEST_RUN_PIPE}[vscode-pytest]: {error}"
929930
print(error_msg, file=sys.stderr)
@@ -943,9 +944,16 @@ def send_message(
943944
data = json.dumps(rpc, cls=cls_encoder)
944945
try:
945946
if __writer:
946-
request = f"""content-length: {len(data)}\ncontent-type: application/json\n\n{data}"""
947-
__writer.write(request)
948-
__writer.flush()
947+
request = (
948+
f"""content-length: {len(data)}\r\ncontent-type: application/json\r\n\r\n{data}"""
949+
)
950+
size = 4096
951+
encoded = request.encode("utf-8")
952+
bytes_written = 0
953+
while bytes_written < len(encoded):
954+
segment = encoded[bytes_written : bytes_written + size]
955+
bytes_written += __writer.write(segment)
956+
__writer.flush()
949957
else:
950958
print(
951959
f"Plugin error connection error[vscode-pytest], writer is None \n[vscode-pytest] data: \n{data} \n",

src/test/testing/common/testingAdapter.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1066,7 +1066,6 @@ suite('End to End Tests: test adapters', () => {
10661066
let callCount = 0;
10671067
let failureOccurred = false;
10681068
let failureMsg = '';
1069-
console.log('EFB: beginning function');
10701069
resultResolver._resolveExecution = async (data, _token?) => {
10711070
// do the following asserts for each time resolveExecution is called, should be called once per test.
10721071
console.log(`pytest execution adapter seg fault error handling \n ${JSON.stringify(data)}`);

src/testTestingRootWkspc/largeWorkspace/test_parameterized_subtest.py

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,106 @@ def test_even(self):
1414
for i in range(0, 2000):
1515
with self.subTest(i=i):
1616
self.assertEqual(i % 2, 0)
17+
18+
19+
# The repeated tests below are to test the unittest communication as it hits it maximum limit of bytes.
20+
21+
22+
class NumberedTests1(unittest.TestCase):
23+
def test_abc(self):
24+
self.assertEqual(1 % 2, 0)
25+
26+
27+
class NumberedTests2(unittest.TestCase):
28+
def test_abc(self):
29+
self.assertEqual(1 % 2, 0)
30+
31+
32+
class NumberedTests3(unittest.TestCase):
33+
def test_abc(self):
34+
self.assertEqual(1 % 2, 0)
35+
36+
37+
class NumberedTests4(unittest.TestCase):
38+
def test_abc(self):
39+
self.assertEqual(1 % 2, 0)
40+
41+
42+
class NumberedTests5(unittest.TestCase):
43+
def test_abc(self):
44+
self.assertEqual(1 % 2, 0)
45+
46+
47+
class NumberedTests6(unittest.TestCase):
48+
def test_abc(self):
49+
self.assertEqual(1 % 2, 0)
50+
51+
52+
class NumberedTests7(unittest.TestCase):
53+
def test_abc(self):
54+
self.assertEqual(1 % 2, 0)
55+
56+
57+
class NumberedTests8(unittest.TestCase):
58+
def test_abc(self):
59+
self.assertEqual(1 % 2, 0)
60+
61+
62+
class NumberedTests9(unittest.TestCase):
63+
def test_abc(self):
64+
self.assertEqual(1 % 2, 0)
65+
66+
67+
class NumberedTests10(unittest.TestCase):
68+
def test_abc(self):
69+
self.assertEqual(1 % 2, 0)
70+
71+
72+
class NumberedTests11(unittest.TestCase):
73+
def test_abc(self):
74+
self.assertEqual(1 % 2, 0)
75+
76+
77+
class NumberedTests12(unittest.TestCase):
78+
def test_abc(self):
79+
self.assertEqual(1 % 2, 0)
80+
81+
82+
class NumberedTests13(unittest.TestCase):
83+
def test_abc(self):
84+
self.assertEqual(1 % 2, 0)
85+
86+
87+
class NumberedTests14(unittest.TestCase):
88+
def test_abc(self):
89+
self.assertEqual(1 % 2, 0)
90+
91+
92+
class NumberedTests15(unittest.TestCase):
93+
def test_abc(self):
94+
self.assertEqual(1 % 2, 0)
95+
96+
97+
class NumberedTests16(unittest.TestCase):
98+
def test_abc(self):
99+
self.assertEqual(1 % 2, 0)
100+
101+
102+
class NumberedTests17(unittest.TestCase):
103+
def test_abc(self):
104+
self.assertEqual(1 % 2, 0)
105+
106+
107+
class NumberedTests18(unittest.TestCase):
108+
def test_abc(self):
109+
self.assertEqual(1 % 2, 0)
110+
111+
112+
class NumberedTests19(unittest.TestCase):
113+
def test_abc(self):
114+
self.assertEqual(1 % 2, 0)
115+
116+
117+
class NumberedTests20(unittest.TestCase):
118+
def test_abc(self):
119+
self.assertEqual(1 % 2, 0)

0 commit comments

Comments
 (0)