From 5dff221842ebb29a7b42fce3d949a1e122b9f846 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Thu, 21 Sep 2017 13:06:59 +0530 Subject: [PATCH] fakessh: cleanup master test. --- tests/fakessh_test.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/fakessh_test.py b/tests/fakessh_test.py index 8ff26e18..8537dbae 100644 --- a/tests/fakessh_test.py +++ b/tests/fakessh_test.py @@ -3,7 +3,6 @@ import os import shutil import unittest -import mitogen.utils import mitogen.fakessh import testlib @@ -12,11 +11,16 @@ import testlib class RsyncTest(testlib.DockerMixin, unittest.TestCase): def test_rsync_from_master(self): context = self.docker_ssh_any() - context.call(shutil.rmtree, '/tmp/data', ignore_errors=True) - mitogen.fakessh.run(context, self.router, [ + + if context.call(os.path.exists, '/tmp/data'): + context.call(shutil.rmtree, '/tmp/data') + + return_code = mitogen.fakessh.run(context, self.router, [ 'rsync', '--progress', '-vvva', testlib.data_path('.'), 'target:/tmp/data' ]) + + assert return_code == 0 assert context.call(os.path.exists, '/tmp/data') assert context.call(os.path.exists, '/tmp/data/simple_pkg/a.py')