Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
apolukhin committed Jan 9, 2025
1 parent ea11f94 commit bce0d8a
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,14 +217,14 @@ def _test_tasks_processor_signals(test_name, path):
def _test_regex_bad(test_name, path):
proc = subprocess.Popen(path, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
inp = "6\n"
out1, out2 = proc.communicate(input=inp)
out1, out2 = proc.communicate(input=inp.encode('utf-8'))

tester.outputs[test_name + "_bad_num"] = (out1, out2, proc.returncode)
tester._test_validate(test_name + "_bad_num")

proc = subprocess.Popen(path, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
inp = "0\n(\\"
out1, out2 = proc.communicate(input=inp)
out1, out2 = proc.communicate(input=inp.encode('utf-8'))

tester.outputs[test_name + "_bad_regex"] = (out1, out2, proc.returncode)
tester._test_validate(test_name + "_bad_regex")
Expand All @@ -242,8 +242,8 @@ def _test_regex_match(test_name, path):

for i in range(2, 6):
proc = subprocess.Popen(path, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
inp = str(i) + b"\n...\nqwe\nqwerty"
out1, out2 = proc.communicate(input=inp)
inp = str(i) + "\n...\nqwe\nqwerty"
out1, out2 = proc.communicate(input=inp.encode('utf-8'))

tester.outputs[test_name + "_extra"] = (out1, out2, proc.returncode)
tester._test_validate(test_name + "_extra")
Expand All @@ -264,11 +264,11 @@ def _test_regex_replace(test_name, path):
proc = subprocess.Popen(path, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
inp = str(i)
if i >= 4:
inp += b"\n\\(.\\)\\(.\\)\\(.\\)\nqwe\n\\3\\2\\1"
inp += "\n\\(.\\)\\(.\\)\\(.\\)\nqwe\n\\3\\2\\1"
else:
inp += b"\n(.)(.)(.)\nqwe\n\\3\\2\\1"
inp += "\n(.)(.)(.)\nqwe\n\\3\\2\\1"

out1, out2 = proc.communicate(input=inp)
out1, out2 = proc.communicate(input=inp.encode('utf-8'))

tester.outputs[test_name + "_extra"] = (out1, out2, proc.returncode)
tester._test_validate(test_name + "_extra")
Expand Down Expand Up @@ -344,12 +344,12 @@ def _test_interprocess_basic(test_name, path):
out2 = ""
retcode = 0
for p in procs:
out1_tmp, out2_tmp = p.communicate(input='any_key')
out1 += out1_tmp
out2 += out2_tmp
out1_tmp, out2_tmp = p.communicate(input=b'any_key')
out1 += out1_tmp.decode('utf-8')
out2 += out2_tmp.decode('utf-8')
retcode += p.returncode

tester.outputs[test_name] = (out1, out2, retcode)
tester.outputs[test_name] = (out1.encode('utf-8'), out2.encode('utf-8'), retcode)
tester._test_validate(test_name)

@staticmethod
Expand All @@ -372,11 +372,11 @@ def _test_interprocess_run_two_concurrently(test_name, path):
retcode = 0
for p in procs:
out1_tmp, out2_tmp = tester.safe_wait(p)
out1 += out1_tmp
out2 += out2_tmp
out1 += out1_tmp.decode('utf-8')
out2 += out2_tmp.decode('utf-8')
retcode += p.returncode

tester.outputs[test_name] = (out1, out2, retcode)
tester.outputs[test_name] = (out1.encode('utf-8'), out2.encode('utf-8'), retcode)
tester._test_validate(test_name)

@staticmethod
Expand Down

0 comments on commit bce0d8a

Please sign in to comment.