From 841c2b13a14662e6b5c05983ef385c82d6addb24 Mon Sep 17 00:00:00 2001 From: Alex Willmer Date: Sun, 1 Apr 2018 01:17:29 +0100 Subject: [PATCH] fakessh_test: Apply timeout decorators to rsync tests timeoutcontext.timeout uses SIGALRM, hence it will only work on Unix like operating systems. --- dev_requirements.txt | 1 + tests/fakessh_test.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/dev_requirements.txt b/dev_requirements.txt index 7761ff4a..3d1b0624 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -9,6 +9,7 @@ pytest-catchlog==1.2.2 pytest==3.1.2 PyYAML==3.11; python_version < '2.7' PyYAML==3.12; python_version >= '2.7' +timeoutcontext==1.2.0 unittest2==1.1.0 # Fix InsecurePlatformWarning while creating py26 tox environment # https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings diff --git a/tests/fakessh_test.py b/tests/fakessh_test.py index 6e28be1d..8711b46b 100644 --- a/tests/fakessh_test.py +++ b/tests/fakessh_test.py @@ -2,6 +2,7 @@ import os import shutil +import timeoutcontext import unittest2 import mitogen.fakessh @@ -10,6 +11,7 @@ import testlib class RsyncTest(testlib.DockerMixin, unittest2.TestCase): + @timeoutcontext.timeout(5) def test_rsync_from_master(self): context = self.docker_ssh_any() @@ -25,6 +27,7 @@ class RsyncTest(testlib.DockerMixin, unittest2.TestCase): self.assertTrue(context.call(os.path.exists, '/tmp/data')) self.assertTrue(context.call(os.path.exists, '/tmp/data/simple_pkg/a.py')) + @timeoutcontext.timeout(5) def test_rsync_between_direct_children(self): # master -> SSH -> has-sudo-pubkey -> rsync(.ssh) -> master -> # has-sudo -> rsync