diff --git a/bigchaindb/commands/bigchain.py b/bigchaindb/commands/bigchain.py index 667ceba8..4134bb0c 100644 --- a/bigchaindb/commands/bigchain.py +++ b/bigchaindb/commands/bigchain.py @@ -36,6 +36,12 @@ logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) +# Note about printing: +# We try to print to stdout for results of a command that may be useful to +# someone (or another program). Strictly informational text, or errors, +# should be printed to stderr. + + def run_show_config(args): """Show the current configuration""" # TODO Proposal: remove the "hidden" configuration. Only show config. If @@ -84,7 +90,7 @@ def run_configure(args, skip_if_exists=False): # select the correct config defaults based on the backend print('Generating default configuration for backend {}' - .format(args.backend)) + .format(args.backend), file=sys.stderr) conf['database'] = bigchaindb._database_map[args.backend] if not args.yes: diff --git a/tests/commands/test_commands.py b/tests/commands/test_commands.py index 991f4961..95587e6c 100644 --- a/tests/commands/test_commands.py +++ b/tests/commands/test_commands.py @@ -133,8 +133,10 @@ def test_bigchain_export_my_pubkey_when_pubkey_set(capsys, monkeypatch): run_export_my_pubkey(args) out, err = capsys.readouterr() lines = out.splitlines() + err_lines = err.splitlines() assert config['keypair']['public'] in lines assert 'Charlie_Bucket' in lines + assert 'bigchaindb args = {}'.format(args) in err_lines def test_bigchain_export_my_pubkey_when_pubkey_not_set(monkeypatch):