From 8a5e6321449d94f449219e9a6fb11e3848533519 Mon Sep 17 00:00:00 2001 From: ponty Date: Sun, 26 Feb 2023 16:39:49 +0100 Subject: [PATCH] test: longer sleeps --- tests/test_fast/test_proc.py | 6 +++--- tests/test_fast/test_returncode.py | 6 +++--- tests/test_fast/test_timeout.py | 18 +++++++++--------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/test_fast/test_proc.py b/tests/test_fast/test_proc.py index 6a04a12..7321490 100644 --- a/tests/test_fast/test_proc.py +++ b/tests/test_fast/test_proc.py @@ -17,13 +17,13 @@ def test_call(): def test_start(): p = EasyProcess("ls -la").start() - time.sleep(0.2) + time.sleep(2) assert p.stop().return_code == 0 def test_start2(): p = EasyProcess("echo hi").start() - time.sleep(0.2) + time.sleep(2) # no wait() -> no results assert p.return_code is None assert p.stdout is None @@ -81,7 +81,7 @@ def test_parse(): def test_stop(): p = EasyProcess("ls -la").start() - time.sleep(0.2) + time.sleep(2) assert p.stop().return_code == 0 assert p.stop().return_code == 0 assert p.stop().return_code == 0 diff --git a/tests/test_fast/test_returncode.py b/tests/test_fast/test_returncode.py index e145658..8d073dc 100644 --- a/tests/test_fast/test_returncode.py +++ b/tests/test_fast/test_returncode.py @@ -3,13 +3,13 @@ def test_return_code(): # process has finished but no stop() or wait() was called - assert EasyProcess("echo hello").start().sleep(0.5).return_code is None + assert EasyProcess("echo hello").start().sleep(2).return_code is None # wait() assert EasyProcess("echo hello").start().wait().return_code == 0 # stop() after process has finished - assert EasyProcess("echo hello").start().sleep(0.5).stop().return_code == 0 + assert EasyProcess("echo hello").start().sleep(2).stop().return_code == 0 # stop() before process has finished assert EasyProcess("sleep 2").start().stop().return_code != 0 @@ -20,7 +20,7 @@ def test_return_code(): def test_is_alive1(): # early exit - p = EasyProcess("echo hello").start().sleep(0.5) + p = EasyProcess("echo hello").start().sleep(2) assert p.return_code is None assert p.stdout is None diff --git a/tests/test_fast/test_timeout.py b/tests/test_fast/test_timeout.py index cdc2f18..23b1e9a 100644 --- a/tests/test_fast/test_timeout.py +++ b/tests/test_fast/test_timeout.py @@ -9,21 +9,21 @@ def test_timeout(): - p = EasyProcess("sleep 1").start() - p.wait(0.2) + p = EasyProcess("sleep 5").start() + p.wait(2) assert p.is_alive() - p.wait(0.2) + p.wait(2) assert p.is_alive() p.wait(2) assert not p.is_alive() - assert EasyProcess("sleep 0.3").call().return_code == 0 - assert EasyProcess("sleep 0.3").call(timeout=0.1).return_code != 0 - assert EasyProcess("sleep 0.3").call(timeout=1).return_code == 0 + assert EasyProcess("sleep 2").call().return_code == 0 + assert EasyProcess("sleep 2").call(timeout=1).return_code != 0 + assert EasyProcess("sleep 2").call(timeout=3).return_code == 0 - assert EasyProcess("sleep 0.3").call().timeout_happened is False - assert EasyProcess("sleep 0.3").call(timeout=0.1).timeout_happened - assert EasyProcess("sleep 0.3").call(timeout=1).timeout_happened is False + assert EasyProcess("sleep 2").call().timeout_happened is False + assert EasyProcess("sleep 2").call(timeout=1).timeout_happened + assert EasyProcess("sleep 2").call(timeout=3).timeout_happened is False @pytest.mark.timeout(10)