From 929502a586e6b0653bb566a79952573ac762bc73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Sun, 16 Dec 2018 22:54:15 +0100 Subject: [PATCH] Implement test case for IO stress --- tests.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests.py b/tests.py index 90a3cf8..7bec774 100644 --- a/tests.py +++ b/tests.py @@ -3,6 +3,7 @@ from os import stat, urandom from os.path import exists, dirname, realpath, join from stat import S_ISFIFO from secrets import token_urlsafe +from random import randint import pytest @@ -65,6 +66,13 @@ def test_io_large_data(pipe_io, test_data_size): assert File(pipe_io.out_pipe).read() == random_data +def test_io_stress(pipe_io): + for _ in range(2222): + random_data = urandom(randint(1, 1024)) + File(pipe_io.in_pipe).write(random_data) + assert File(pipe_io.out_pipe).read() == random_data + + def test_stop_removes_pipes(pipe_io): pipe_io.stop() for path in (pipe_io.in_pipe, pipe_io.out_pipe):