From c3b6fc761e067525dd3ffba352f8262878223584 Mon Sep 17 00:00:00 2001 From: Radomir Dopieralski Date: Wed, 15 Mar 2017 18:41:19 +0100 Subject: [PATCH] Make extract_messages quiet in pep8 test The additional extract_messages call in the pep8 tox environment generates a lot of meaningless output, that then makes it difficult to spot actual failures and warnings. This patch makes the Django command respect the verbosity setting and call the setup.py command with a quiet flag if low verbosity is requested, considerably decreasing the amount of useless output. It then sets that verbosity to low in the corresponding tox environment. Change-Id: I2976250a23e800fbb582726299670b57199b58a7 --- .../management/commands/extract_messages.py | 8 +++++--- tox.ini | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/openstack_dashboard/management/commands/extract_messages.py b/openstack_dashboard/management/commands/extract_messages.py index f015f26b38..95049e8c9d 100644 --- a/openstack_dashboard/management/commands/extract_messages.py +++ b/openstack_dashboard/management/commands/extract_messages.py @@ -37,11 +37,13 @@ class Command(BaseCommand): "polluting the source code")) def handle(self, *args, **options): - cmd = ('python setup.py extract_messages -F babel-{domain}.cfg ' + cmd = ('python setup.py {quiet} extract_messages ' + '-F babel-{domain}.cfg ' '-o {module}/locale/{domain}.pot') distribution = Distribution() distribution.parse_config_files(distribution.find_config_files()) + quiet = '-q' if int(options['verbosity']) == 0 else '' if options['check_only']: cmd += " ; rm {module}/locale/{domain}.pot" @@ -53,5 +55,5 @@ class Command(BaseCommand): with open(potfile, 'wb') as f: f.write(b'') - call(cmd.format(module=module, domain=domain, potfile=potfile), - shell=True) + call(cmd.format(module=module, domain=domain, potfile=potfile, + quiet=quiet), shell=True) diff --git a/tox.ini b/tox.ini index 3b30f3cd5f..20421747e8 100644 --- a/tox.ini +++ b/tox.ini @@ -56,7 +56,7 @@ commands = bash {toxinidir}/tools/unit_tests.sh {envpython} {toxinidir} {posargs [testenv:pep8] usedevelop = True commands = - {envpython} {toxinidir}/manage.py extract_messages --check-only + {envpython} {toxinidir}/manage.py extract_messages --verbosity 0 --check-only flake8 [testenv:cover]