_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()
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)
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:
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'.+')