5652: Readability improvements.
authorLucas Di Pentima <lucas@curoverse.com>
Mon, 17 Jul 2017 17:18:05 +0000 (14:18 -0300)
committerLucas Di Pentima <lucas@curoverse.com>
Mon, 17 Jul 2017 17:18:05 +0000 (14:18 -0300)
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas@curoverse.com>

sdk/python/arvados/commands/put.py
sdk/python/tests/test_arv_get.py
sdk/python/tests/test_arv_put.py

index b357bc94b8441380fffae5d41a96fa95c6bf5600..afd9bdcd89d07b2b4447b059a33b49ccbe483a6c 100644 (file)
@@ -195,7 +195,7 @@ total data size).
 
 _group.add_argument('--silent', action='store_true',
                     help="""
-Do not produce any output unless an error happens.
+Do not print any debug messages to console. (Any error messages will still be displayed.)
 """)
 
 _group = run_opts.add_mutually_exclusive_group()
index eb9a71fac960c3fd8a3e3d83c1d1cfec6cefc3df..fc6b846c39f2ee4737b91b9638af576121297103 100644 (file)
@@ -153,21 +153,24 @@ class ArvadosGetTestCase(run_test_server.TestCaseWithServers,
         tmpdir = self.make_tmpdir()
         # Simulate a TTY stderr
         stderr = mock.MagicMock()
-        stderr.isatty.return_value = True
         stdout = tutil.BytesIO()
+
         # Confirm that progress is written to stderr when is a tty
+        stderr.isatty.return_value = True
         r = arv_get.main(['{}/bigfile.txt'.format(c.manifest_locator()),
                           '{}/bigfile.txt'.format(tmpdir)],
                          stdout, stderr)
         self.assertEqual(0, r)
         self.assertEqual(b'', stdout.getvalue())
         self.assertTrue(stderr.write.called)
+
         # Clean up and reset stderr mock
         os.remove('{}/bigfile.txt'.format(tmpdir))
         stderr = mock.MagicMock()
-        stderr.isatty.return_value = False
         stdout = tutil.BytesIO()
+
         # Confirm that progress is not written to stderr when isn't a tty
+        stderr.isatty.return_value = False
         r = arv_get.main(['{}/bigfile.txt'.format(c.manifest_locator()),
                           '{}/bigfile.txt'.format(tmpdir)],
                          stdout, stderr)
index 756e37885ec2f996a6f07b1c29570871f8a25f13..ce6618132d011056c13580c9497abf4072cc7dc3 100644 (file)
@@ -969,7 +969,7 @@ class ArvPutIntegrationTest(run_test_server.TestCaseWithServers,
                          r'^\./%s.*:file2.txt' % os.path.basename(tmpdir))
         self.assertRegex(c['manifest_text'], r'^.*:file3.txt')
 
-    def test_silent_mode(self):
+    def test_silent_mode_no_errors(self):
         self.authorize_with('active')
         tmpdir = self.make_tmpdir()
         with open(os.path.join(tmpdir, 'test.txt'), 'w') as f:
@@ -979,7 +979,7 @@ class ArvPutIntegrationTest(run_test_server.TestCaseWithServers,
             stdin=subprocess.PIPE, stdout=subprocess.PIPE,
             stderr=subprocess.PIPE, env=self.ENVIRON)
         stdout, stderr = pipe.communicate()
-        # No output should occur on normal operations
+        # No console output should occur on normal operations
         self.assertNotRegex(stderr.decode(), r'.+')
         self.assertNotRegex(stdout.decode(), r'.+')