aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/test
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2019-12-13 07:00:28 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2019-12-13 07:00:28 +0300
commit0d8ffed538d5f501b2328d58fa07e88c5d2ca9bb (patch)
tree23aa6552f1d9bff710b4b3e424e2fb884920a57c /test
parentREADME: update (diff)
downloadmath-server-0d8ffed538d5f501b2328d58fa07e88c5d2ca9bb.tar.gz
math-server-0d8ffed538d5f501b2328d58fa07e88c5d2ca9bb.zip
stress_test.py: fix for 3.6
Diffstat (limited to 'test')
-rw-r--r--test/stress_test.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/test/stress_test.py b/test/stress_test.py
index b339f36..749fdf3 100644
--- a/test/stress_test.py
+++ b/test/stress_test.py
@@ -5,6 +5,7 @@ import math
from multiprocessing import Pool
import random
import subprocess
+from subprocess import PIPE
import sys
from timeit import default_timer
@@ -35,7 +36,8 @@ def timer(description):
def run_client(i, client, stdin):
with timer(f"Invocation #{i}"):
cmd = client.get_command_line()
- result = subprocess.run(cmd, text=True, input=stdin, capture_output=True)
+ result = subprocess.run(cmd, stdout=PIPE, stderr=PIPE, input=stdin,
+ universal_newlines=True)
result.check_returncode()
return result
@@ -72,7 +74,7 @@ def run_stress_test(args):
results = pool.starmap(run_client, [(i, client, stdin) for i in range(args.processes)])
assert results
# It's assumed every invocation gives the same output, yikes.
- actual_output = list(map(float, results[0].stdout.split('\n\n')[:-1]))
+ actual_output = list(map(float, results[0].stdout.split('\n')[:-1]))
assert len(expected_output) == len(actual_output)
for i in range(len(expected_output)):
if math.isclose(expected_output[i], actual_output[i]):