From 18f3b51a1795922a5c5c595b5b3fb5ce12978c64 Mon Sep 17 00:00:00 2001 From: Lucas Di Pentima Date: Tue, 2 May 2017 11:52:44 -0300 Subject: [PATCH] 11579: Added assertion on test to check for file symlinks to be copied by default. Don't treat a PathDoesNotExist exception as an abnormal termination, just log the proper error message, and quit. --- sdk/python/arvados/commands/put.py | 7 +++++-- sdk/python/tests/test_arv_put.py | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/sdk/python/arvados/commands/put.py b/sdk/python/arvados/commands/put.py index ddc261f00f..6836d80388 100644 --- a/sdk/python/arvados/commands/put.py +++ b/sdk/python/arvados/commands/put.py @@ -474,7 +474,10 @@ class ArvPutUploadJob(object): # Note: We're expecting SystemExit instead of KeyboardInterrupt because # we have a custom signal handler in place that raises SystemExit with # the catched signal's code. - if not isinstance(e, SystemExit) or e.code != -2: + if isinstance(e, PathDoesNotExistError): + # We aren't interested in the traceback for this case + pass + elif not isinstance(e, SystemExit) or e.code != -2: self.logger.warning("Abnormal termination:\n{}".format(traceback.format_exc(e))) raise finally: @@ -985,7 +988,7 @@ def main(arguments=None, stdout=sys.stdout, stderr=sys.stderr): except PathDoesNotExistError as error: logger.error("\n".join([ "arv-put: %s" % str(error)])) - exit(1) + sys.exit(1) if args.progress: # Print newline to split stderr from stdout for humans. logger.info("\n") diff --git a/sdk/python/tests/test_arv_put.py b/sdk/python/tests/test_arv_put.py index 2d17cb8cad..320189104a 100644 --- a/sdk/python/tests/test_arv_put.py +++ b/sdk/python/tests/test_arv_put.py @@ -286,6 +286,7 @@ class ArvPutUploadJobTest(run_test_server.TestCaseWithServers, cwriter = arv_put.ArvPutUploadJob([self.tempdir_with_symlink]) cwriter.start(save_collection=False) self.assertIn('linkeddir', cwriter.manifest_text()) + self.assertIn('linkedfile', cwriter.manifest_text()) cwriter.destroy_cache() def test_symlinks_are_not_followed_when_requested(self): -- 2.30.2