Page MenuHomePhabricator

Jenkins output for pywikibot job is hard to read
Closed, ResolvedPublic

Description

For example:

https://integration.wikimedia.org/ci/job/tox-jessie/1169/console

[tox-jessie] $ /bin/bash -xe /tmp/hudson5485247455240381787.sh
16:33:15 + rm -fR log
16:33:15 + mkdir -p log
16:33:15 + set -o pipefail
16:33:15 + PY_COLORS=1
16:33:15 + tox -v
16:33:15 + tee log/stdout.log
16:33:15 using tox.ini: /home/jenkins/workspace/tox-jessie/tox.ini
16:33:15 using tox-1.9.2 from /usr/local/lib/python2.7/dist-packages/tox/__init__.pyc
16:33:15 flake8 create: /home/jenkins/workspace/tox-jessie/.tox/flake8
16:33:15   /home/jenkins/workspace/tox-jessie/.tox$ /usr/bin/python -m virtualenv --setuptools --python /usr/bin/python2.7 flake8 >/home/jenkins/workspace/tox-jessie/.tox/flake8/log/flake8-0.log
16:33:18 flake8 installdeps: flake8, hacking, flake8-docstrings, flake8-coding, flake8-future-import, flake8-string-format
16:33:18   /home/jenkins/workspace/tox-jessie$ /home/jenkins/workspace/tox-jessie/.tox/flake8/bin/pip install --process-dependency-links --pre flake8 hacking flake8-docstrings flake8-coding flake8-future-import flake8-string-format >/home/jenkins/workspace/tox-jessie/.tox/flake8/log/flake8-1.log
16:33:20 flake8 develop-inst: /home/jenkins/workspace/tox-jessie
16:33:20   /home/jenkins/workspace/tox-jessie$ /home/jenkins/workspace/tox-jessie/.tox/flake8/bin/pip install --process-dependency-links --pre -e /home/jenkins/workspace/tox-jessie >/home/jenkins/workspace/tox-jessie/.tox/flake8/log/flake8-2.log
16:33:24 flake8 runtests: PYTHONHASHSEED='2324724050'
16:33:24 flake8 runtests: commands[0] | flake8 --version
16:33:24   /home/jenkins/workspace/tox-jessie$ /home/jenkins/workspace/tox-jessie/.tox/flake8/bin/flake8 --version 
16:33:24 2.5.0 (pep8: 1.5.7, pep257: 0.2.1.post1, pyflakes: 1.0.0, flake8_coding: 1.1.1, hacking.core: 0.0.1, ProxyChecker: 0.0.1, mccabe: 0.3.1, flake8-string-format: 0.2.1, flake8-future-import: 0.3.2) CPython 2.7.9 on Linux
16:33:24 flake8 runtests: commands[1] | flake8 --ignore=D102,D103,E241,E402,E731,D105,D211,FI10,FI12,FI13,FI15,FI5,H101,H201,H202,H236,H237,H301,H306,H404,H405,P102,P103
16:33:24   /home/jenkins/workspace/tox-jessie$ /home/jenkins/workspace/tox-jessie/.tox/flake8/bin/flake8 --ignore=D102,D103,E241,E402,E731,D105,D211,FI10,FI12,FI13,FI15,FI5,H101,H201,H202,H236,H237,H301,H306,H404,H405,P102,P103 
16:33:25 ./pywikibot/__init__.py:469:1: E303 too many blank lines (3)
16:34:13 ./tests/wikibase_tests.py:187:5: E303 too many blank lines (2)
16:34:14 ERROR: InvocationError: '/home/jenkins/workspace/tox-jessie/.tox/flake8/bin/flake8 --ignore=D102,D103,E241,E402,E731,D105,D211,FI10,FI12,FI13,FI15,FI5,H101,H201,H202,H236,H237,H301,H306,H404,H405,P102,P103'
16:34:14 flake8-py3 create: /home/jenkins/workspace/tox-jessie/.tox/flake8-py3
16:34:14   /home/jenkins/workspace/tox-jessie/.tox$ /usr/bin/python -m virtualenv --setuptools --python /usr/bin/python3 flake8-py3 >/home/jenkins/workspace/tox-jessie/.tox/flake8-py3/log/flake8-py3-0.log
16:34:17 flake8-py3 installdeps: flake8, flake8-docstrings
16:34:17   /home/jenkins/workspace/tox-jessie$ /home/jenkins/workspace/tox-jessie/.tox/flake8-py3/bin/pip install --process-dependency-links --pre flake8 flake8-docstrings >/home/jenkins/workspace/tox-jessie/.tox/flake8-py3/log/flake8-py3-1.log
16:34:19 flake8-py3 develop-inst: /home/jenkins/workspace/tox-jessie
16:34:19   /home/jenkins/workspace/tox-jessie$ /home/jenkins/workspace/tox-jessie/.tox/flake8-py3/bin/pip install --process-dependency-links --pre -e /home/jenkins/workspace/tox-jessie >/home/jenkins/workspace/tox-jessie/.tox/flake8-py3/log/flake8-py3-2.log
16:34:21 flake8-py3 runtests: PYTHONHASHSEED='2324724050'
16:34:21 flake8-py3 runtests: commands[0] | flake8 --version
16:34:21   /home/jenkins/workspace/tox-jessie$ /home/jenkins/workspace/tox-jessie/.tox/flake8-py3/bin/flake8 --version 
16:34:21 2.5.0 (pep8: 1.5.7, pep257: 0.2.1.post1, pyflakes: 1.0.0, mccabe: 0.3.1) CPython 3.4.2 on Linux
16:34:21 flake8-py3 runtests: commands[1] | flake8 --ignore=D102,D103,E241,E402,E731,D105,D211,FI10,FI12,FI13,FI15,FI5,H101,H201,H202,H236,H237,H301,H306,H404,H405,P102,P103
16:34:21   /home/jenkins/workspace/tox-jessie$ /home/jenkins/workspace/tox-jessie/.tox/flake8-py3/bin/flake8 --ignore=D102,D103,E241,E402,E731,D105,D211,FI10,FI12,FI13,FI15,FI5,H101,H201,H202,H236,H237,H301,H306,H404,H405,P102,P103 
16:34:21   unknown option 'accept-encodings' ignored
16:34:21   unknown option 'require-code' ignored
16:34:22 ./pywikibot/__init__.py:469:1: E303 too many blank lines (3)
16:35:04 ./tests/wikibase_tests.py:187:5: E303 too many blank lines (2)
16:35:04 ERROR: InvocationError: '/home/jenkins/workspace/tox-jessie/.tox/flake8-py3/bin/flake8 --ignore=D102,D103,E241,E402,E731,D105,D211,FI10,FI12,FI13,FI15,FI5,H101,H201,H202,H236,H237,H301,H306,H404,H405,P102,P103'
16:35:04 flake8-docstrings-mandatory create: /home/jenkins/workspace/tox-jessie/.tox/flake8-docstrings-mandatory
16:35:04   /home/jenkins/workspace/tox-jessie/.tox$ /usr/bin/python -m virtualenv --setuptools --python /usr/bin/python flake8-docstrings-mandatory >/home/jenkins/workspace/tox-jessie/.tox/flake8-docstrings-mandatory/log/flake8-docstrings-mandatory-0.log
16:35:07 flake8-docstrings-mandatory installdeps: flake8>=2.2.5, flake8-docstrings
16:35:07   /home/jenkins/workspace/tox-jessie$ /home/jenkins/workspace/tox-jessie/.tox/flake8-docstrings-mandatory/bin/pip install --process-dependency-links --pre flake8>=2.2.5 flake8-docstrings >/home/jenkins/workspace/tox-jessie/.tox/flake8-docstrings-mandatory/log/flake8-docstrings-mandatory-1.log
16:35:08 flake8-docstrings-mandatory develop-inst: /home/jenkins/workspace/tox-jessie
16:35:08   /home/jenkins/workspace/tox-jessie$ /home/jenkins/workspace/tox-jessie/.tox/flake8-docstrings-mandatory/bin/pip install --process-dependency-links --pre -e /home/jenkins/workspace/tox-jessie >/home/jenkins/workspace/tox-jessie/.tox/flake8-docstrings-mandatory/log/flake8-docstrings-mandatory-2.log
16:35:10 flake8-docstrings-mandatory runtests: PYTHONHASHSEED='2324724050'
16:35:10 flake8-docstrings-mandatory runtests: commands[0] | flake8 docs/conf.py ez_setup.py generate_user_files.py pwb.py pywikibot/__init__.py pywikibot/backports.py pywikibot/bot.py pywikibot/bot_choice.py pywikibot/botirc.py pywikibot/comms/ pywikibot/compat/ pywikibot/config2.py pywikibot/daemonize.py pywikibot/data/ pywikibot/date.py pywikibot/diff.py pywikibot/echo.py pywikibot/editor.py pywikibot/exceptions.py pywikibot/family.py pywikibot/flow.py pywikibot/interwiki_graph.py pywikibot/families/ pywikibot/fixes.py pywikibot/i18n.py pywikibot/logentries.py pywikibot/logging.py pywikibot/login.py pywikibot/page.py pywikibot/pagegenerators.py pywikibot/plural.py pywikibot/proofreadpage.py pywikibot/site_detect.py pywikibot/site.py pywikibot/textlib.py pywikibot/throttle.py pywikibot/titletranslate.py pywikibot/tools/ pywikibot/userinterfaces/ pywikibot/version.py pywikibot/weblib.py pywikibot/xmlreader.py scripts/__init__.py scripts/add_text.py scripts/basic.py scripts/blockpageschecker.py scripts/blockreview.py scripts/capitalize_redirects.py scripts/category.py scripts/category_redirect.py scripts/claimit.py scripts/clean_sandbox.py scripts/commonscat.py scripts/coordinate_import.py scripts/cosmetic_changes.py scripts/create_categories.py scripts/data_ingestion.py scripts/delete.py scripts/disambredir.py scripts/djvutext.py scripts/editarticle.py scripts/fixing_redirects.py scripts/flickrripper.py scripts/harvest_template.py scripts/illustrate_wikidata.py scripts/image.py scripts/imagerecat.py scripts/imageuncat.py scripts/listpages.py scripts/login.py scripts/maintenance/__init__.py scripts/maintenance/make_i18n_dict.py scripts/misspelling.py scripts/newitem.py scripts/noreferences.py scripts/pagefromfile.py scripts/patrol.py scripts/piper.py scripts/protect.py scripts/replace.py scripts/selflink.py scripts/shell.py scripts/spamremove.py scripts/states_redirect.py scripts/template.py scripts/touch.py scripts/transferbot.py scripts/unlink.py scripts/unusedfiles.py scripts/upload.py scripts/version.py scripts/watchlist.py setup.py tests/__init__.py tests/aspects.py tests/utils.py tests/api_tests.py tests/archivebot_tests.py tests/basepage_tests.py tests/bot_tests.py tests/cache_tests.py tests/category_tests.py tests/checkimages_tests.py tests/cosmetic_changes_tests.py tests/data/ tests/data_ingestion_tests.py tests/date_tests.py tests/deletionbot_tests.py tests/disambredir_tests.py tests/djvu_tests.py tests/dry_api_tests.py tests/edit_tests.py tests/edit_failure_tests.py tests/exceptions_tests.py tests/family_tests.py tests/file_tests.py tests/flow_edit_tests.py tests/flow_tests.py tests/http_tests.py tests/i18n/ tests/interwiki_graph_tests.py tests/interwiki_link_tests.py tests/l10n_tests.py tests/link_tests.py tests/logentry_tests.py tests/mediawikiversion_tests.py tests/namespace_tests.py tests/oauth_tests.py tests/page_tests.py tests/paraminfo_tests.py tests/proofreadpage_tests.py tests/protectbot_tests.py tests/pwb/ tests/pwb_tests.py tests/python_tests.py tests/reflinks_tests.py tests/replacebot_tests.py tests/script_tests.py tests/site_detect_tests.py tests/tests_tests.py tests/timestamp_tests.py tests/timestripper_tests.py tests/thread_tests.py tests/tk_tests.py tests/tools_chars_tests.py tests/tools_ip_tests.py tests/tools_tests.py tests/ui_options_tests.py tests/upload_tests.py tests/uploadbot_tests.py tests/weblib_tests.py tests/weblinkchecker_tests.py tests/wikibase_edit_tests.py tests/wikidataquery_tests.py tests/wikistats_tests.py tests/xmlreader_tests.py
16:35:10   /home/jenkins/workspace/tox-jessie$ /home/jenkins/workspace/tox-jessie/.tox/flake8-docstrings-mandatory/bin/flake8 docs/conf.py ez_setup.py generate_user_files.py pwb.py pywikibot/__init__.py pywikibot/backports.py pywikibot/bot.py pywikibot/bot_choice.py pywikibot/botirc.py pywikibot/comms/ pywikibot/compat/ pywikibot/config2.py pywikibot/daemonize.py pywikibot/data/ pywikibot/date.py pywikibot/diff.py pywikibot/echo.py pywikibot/editor.py pywikibot/exceptions.py pywikibot/family.py pywikibot/flow.py pywikibot/interwiki_graph.py pywikibot/families/ pywikibot/fixes.py pywikibot/i18n.py pywikibot/logentries.py pywikibot/logging.py pywikibot/login.py pywikibot/page.py pywikibot/pagegenerators.py pywikibot/plural.py pywikibot/proofreadpage.py pywikibot/site_detect.py pywikibot/site.py pywikibot/textlib.py pywikibot/throttle.py pywikibot/titletranslate.py pywikibot/tools/ pywikibot/userinterfaces/ pywikibot/version.py pywikibot/weblib.py pywikibot/xmlreader.py scripts/__init__.py scripts/add_text.py scripts/basic.py scripts/blockpageschecker.py scripts/blockreview.py scripts/capitalize_redirects.py scripts/category.py scripts/category_redirect.py scripts/claimit.py scripts/clean_sandbox.py scripts/commonscat.py scripts/coordinate_import.py scripts/cosmetic_changes.py scripts/create_categories.py scripts/data_ingestion.py scripts/delete.py scripts/disambredir.py scripts/djvutext.py scripts/editarticle.py scripts/fixing_redirects.py scripts/flickrripper.py scripts/harvest_template.py scripts/illustrate_wikidata.py scripts/image.py scripts/imagerecat.py scripts/imageuncat.py scripts/listpages.py scripts/login.py scripts/maintenance/__init__.py scripts/maintenance/make_i18n_dict.py scripts/misspelling.py scripts/newitem.py scripts/noreferences.py scripts/pagefromfile.py scripts/patrol.py scripts/piper.py scripts/protect.py scripts/replace.py scripts/selflink.py scripts/shell.py scripts/spamremove.py scripts/states_redirect.py scripts/template.py scripts/touch.py scripts/transferbot.py scripts/unlink.py scripts/unusedfiles.py scripts/upload.py scripts/version.py scripts/watchlist.py setup.py tests/__init__.py tests/aspects.py tests/utils.py tests/api_tests.py tests/archivebot_tests.py tests/basepage_tests.py tests/bot_tests.py tests/cache_tests.py tests/category_tests.py tests/checkimages_tests.py tests/cosmetic_changes_tests.py tests/data/ tests/data_ingestion_tests.py tests/date_tests.py tests/deletionbot_tests.py tests/disambredir_tests.py tests/djvu_tests.py tests/dry_api_tests.py tests/edit_tests.py tests/edit_failure_tests.py tests/exceptions_tests.py tests/family_tests.py tests/file_tests.py tests/flow_edit_tests.py tests/flow_tests.py tests/http_tests.py tests/i18n/ tests/interwiki_graph_tests.py tests/interwiki_link_tests.py tests/l10n_tests.py tests/link_tests.py tests/logentry_tests.py tests/mediawikiversion_tests.py tests/namespace_tests.py tests/oauth_tests.py tests/page_tests.py tests/paraminfo_tests.py tests/proofreadpage_tests.py tests/protectbot_tests.py tests/pwb/ tests/pwb_tests.py tests/python_tests.py tests/reflinks_tests.py tests/replacebot_tests.py tests/script_tests.py tests/site_detect_tests.py tests/tests_tests.py tests/timestamp_tests.py tests/timestripper_tests.py tests/thread_tests.py tests/tk_tests.py tests/tools_chars_tests.py tests/tools_ip_tests.py tests/tools_tests.py tests/ui_options_tests.py tests/upload_tests.py tests/uploadbot_tests.py tests/weblib_tests.py tests/weblinkchecker_tests.py tests/wikibase_edit_tests.py tests/wikidataquery_tests.py tests/wikistats_tests.py tests/xmlreader_tests.py 
16:35:10   unknown option 'accept-encodings' ignored
16:35:10   unknown option 'require-code' ignored
16:35:11 pywikibot/__init__.py:469:1: E303 too many blank lines (3)
16:35:33 ERROR: InvocationError: '/home/jenkins/workspace/tox-jessie/.tox/flake8-docstrings-mandatory/bin/flake8 docs/conf.py ez_setup.py generate_user_files.py pwb.py pywikibot/__init__.py pywikibot/backports.py pywikibot/bot.py pywikibot/bot_choice.py pywikibot/botirc.py pywikibot/comms/ pywikibot/compat/ pywikibot/config2.py pywikibot/daemonize.py pywikibot/data/ pywikibot/date.py pywikibot/diff.py pywikibot/echo.py pywikibot/editor.py pywikibot/exceptions.py pywikibot/family.py pywikibot/flow.py pywikibot/interwiki_graph.py pywikibot/families/ pywikibot/fixes.py pywikibot/i18n.py pywikibot/logentries.py pywikibot/logging.py pywikibot/login.py pywikibot/page.py pywikibot/pagegenerators.py pywikibot/plural.py pywikibot/proofreadpage.py pywikibot/site_detect.py pywikibot/site.py pywikibot/textlib.py pywikibot/throttle.py pywikibot/titletranslate.py pywikibot/tools/ pywikibot/userinterfaces/ pywikibot/version.py pywikibot/weblib.py pywikibot/xmlreader.py scripts/__init__.py scripts/add_text.py scripts/basic.py scripts/blockpageschecker.py scripts/blockreview.py scripts/capitalize_redirects.py scripts/category.py scripts/category_redirect.py scripts/claimit.py scripts/clean_sandbox.py scripts/commonscat.py scripts/coordinate_import.py scripts/cosmetic_changes.py scripts/create_categories.py scripts/data_ingestion.py scripts/delete.py scripts/disambredir.py scripts/djvutext.py scripts/editarticle.py scripts/fixing_redirects.py scripts/flickrripper.py scripts/harvest_template.py scripts/illustrate_wikidata.py scripts/image.py scripts/imagerecat.py scripts/imageuncat.py scripts/listpages.py scripts/login.py scripts/maintenance/__init__.py scripts/maintenance/make_i18n_dict.py scripts/misspelling.py scripts/newitem.py scripts/noreferences.py scripts/pagefromfile.py scripts/patrol.py scripts/piper.py scripts/protect.py scripts/replace.py scripts/selflink.py scripts/shell.py scripts/spamremove.py scripts/states_redirect.py scripts/template.py scripts/touch.py scripts/transferbot.py scripts/unlink.py scripts/unusedfiles.py scripts/upload.py scripts/version.py scripts/watchlist.py setup.py tests/__init__.py tests/aspects.py tests/utils.py tests/api_tests.py tests/archivebot_tests.py tests/basepage_tests.py tests/bot_tests.py tests/cache_tests.py tests/category_tests.py tests/checkimages_tests.py tests/cosmetic_changes_tests.py tests/data/ tests/data_ingestion_tests.py tests/date_tests.py tests/deletionbot_tests.py tests/disambredir_tests.py tests/djvu_tests.py tests/dry_api_tests.py tests/edit_tests.py tests/edit_failure_tests.py tests/exceptions_tests.py tests/family_tests.py tests/file_tests.py tests/flow_edit_tests.py tests/flow_tests.py tests/http_tests.py tests/i18n/ tests/interwiki_graph_tests.py tests/interwiki_link_tests.py tests/l10n_tests.py tests/link_tests.py tests/logentry_tests.py tests/mediawikiversion_tests.py tests/namespace_tests.py tests/oauth_tests.py tests/page_tests.py tests/paraminfo_tests.py tests/proofreadpage_tests.py tests/protectbot_tests.py tests/pwb/ tests/pwb_tests.py tests/python_tests.py tests/reflinks_tests.py tests/replacebot_tests.py tests/script_tests.py tests/site_detect_tests.py tests/tests_tests.py tests/timestamp_tests.py tests/timestripper_tests.py tests/thread_tests.py tests/tk_tests.py tests/tools_chars_tests.py tests/tools_ip_tests.py tests/tools_tests.py tests/ui_options_tests.py tests/upload_tests.py tests/uploadbot_tests.py tests/weblib_tests.py tests/weblinkchecker_tests.py tests/wikibase_edit_tests.py tests/wikidataquery_tests.py tests/wikistats_tests.py tests/xmlreader_tests.py'
16:35:33 ___________________________________ summary ____________________________________
16:35:33 ERROR:   flake8: commands failed
16:35:33 ERROR:   flake8-py3: commands failed
16:35:33 ERROR:   flake8-docstrings-mandatory: commands failed
16:35:33 Build step 'Execute shell' marked build as failure
16:35:34 Archiving artifacts
16:35:36 Archiving artifacts
16:35:36 Finished: FAILURE

The actual issues are completely hidden within the noise, and are also mostly duplicates:

16:33:25 ./pywikibot/__init__.py:469:1: E303 too many blank lines (3)
16:34:13 ./tests/wikibase_tests.py:187:5: E303 too many blank lines (2)
16:34:22 ./pywikibot/__init__.py:469:1: E303 too many blank lines (3)
16:35:04 ./tests/wikibase_tests.py:187:5: E303 too many blank lines (2)
16:35:11 pywikibot/__init__.py:469:1: E303 too many blank lines (3)

Event Timeline

valhallasw raised the priority of this task from to Needs Triage.
valhallasw updated the task description. (Show Details)
valhallasw added projects: Pywikibot, Jenkins.
valhallasw subscribed.

The duplicates are because we have flake8 for Python 2 (flake8) and Python 3 (flake8-py3) and a set of more strict rules (flake8-docstrings-mandatory). And for example pywikibot/__init__ is tested by all while tests/wikibase_tests is not tested by flake8-docstrings-mandatory (which is only working on specific files and tus the different output in line 5).

And with regarding having the results hidden in the output, this is due to 7a35ea9 (T87169) as that runs multiple tests in one suite. So without that patch you would still have the duplicates but separated over multiple runs.

So I'm not sure what can be done here. Integration could actually fix the issue that it does not run tests for non-whitelisted users, althoug just running the “jenkins” environment seems sensible to me. Then pywikibot changes how it runs the tests (but that could only apply to duplicates). And maybe the implementation for tox should have some way to show the results at the end instead with the other output.

valhallasw@maeglin:pywikibot-core$ grep consoleText -P -e ':\d+:\d+:\s[A-Z]+[0-9]+' | sed -e 's:^./::' | sort | uniq
pywikibot/__init__.py:469:1: E303 too many blank lines (3)
tests/wikibase_tests.py:187:5: E303 too many blank lines (2)

Change 262696 had a related patch set uploaded (by John Vandenberg):
Colourise flake8 output

https://gerrit.wikimedia.org/r/262696

To help alleviate the problem, I've created a flake8 plugin to allow ANSI escape sequences using \e , so that the errors can be highlighted in the jenkins log.
https://pypi.python.org/pypi/flake8-format-ansi

To see it working: https://integration.wikimedia.org/ci/job/tox-jessie/3225/console

currently we are getting this on each change in ops/puppet:

operations-puppet-tox-pep8 FAILURE in 2s (non-voting)

due to:

23:25:04 **ERROR: unknown environment 'pep8'

example https://integration.wikimedia.org/ci/job/operations-puppet-tox-pep8/45/console

currently we are getting this on each change in ops/puppet:

operations-puppet-tox-pep8 FAILURE in 2s (non-voting)

due to:

23:25:04 **ERROR: unknown environment 'pep8'

example https://integration.wikimedia.org/ci/job/operations-puppet-tox-pep8/45/console

I suspect that is related to T114887

Krinkle renamed this task from jenkins output is unreadable to Jenkins output for pywikibot job is hard to read.Mar 29 2017, 4:47 PM

I came across console output that for some reason hasn't the ascii escape sequences interpreted, making the output even harder to read: https://integration.wikimedia.org/ci/job/phabricator-jessie-diffs/870/console

e.g.

11:20:56 using tox-2.5.0 from /usr/local/lib/python2.7/dist-packages/tox/__init__.pyc
11:20:56 flake8 create: /srv/jenkins-workspace/workspace/phabricator-jessie-diffs/.tox/flake8
11:20:56   /srv/jenkins-workspace/workspace/phabricator-jessie-diffs/.tox$ /usr/bin/python -m virtualenv --python /usr/bin/python flake8 >/srv/jenkins-workspace/workspace/phabricator-jessie-diffs/.tox/flake8/log/flake8-0.log
11:21:00 flake8 installdeps: flake8

Change 395483 had a related patch set uploaded (by Dalba; owner: Dalba):
[pywikibot/core@master] Migrate from flake8-putty to flake8-per-file-ignores

https://gerrit.wikimedia.org/r/395483

Xqt triaged this task as Lowest priority.Jan 27 2018, 2:01 PM
Xqt claimed this task.

I think it is better now.

I don't think so, it is similar to the example in description

Xqt removed Xqt as the assignee of this task.Mar 5 2020, 10:45 PM

I think sth like

10:56:08 flake8-py27 run-test: commands[0] | flake8 --doctests
10:56:08 [173] /src$ /src/.tox/flake8-py27/bin/flake8 --doctests
10:56:40 ./tests/flow_tests.py:226:80: E501 line too long (81 > 79 characters)
10:56:40 ./tests/flow_tests.py:227:80: E501 line too long (82 > 79 characters)
10:56:40 ./tests/flow_tests.py:233:80: E501 line too long (82 > 79 characters)
10:56:40 ./tests/flow_tests.py:268:80: E501 line too long (83 > 79 characters)
10:56:40 ./tests/flow_tests.py:271:80: E501 line too long (83 > 79 characters)
10:56:40 ./tests/flow_tests.py:275:80: E501 line too long (83 > 79 characters)
10:56:40 ./tests/flow_tests.py:276:80: E501 line too long (83 > 79 characters)
10:56:40 ./pywikibot/flow.py:443:80: E501 line too long (82 > 79 characters)
10:56:40 ./pywikibot/flow.py:697:80: E501 line too long (80 > 79 characters)
10:56:40 ./pywikibot/flow.py:763:80: E501 line too long (84 > 79 characters)
10:56:40 ./pywikibot/site.py:7358:80: E501 line too long (80 > 79 characters)
10:56:40 ERROR: InvocationError for command /src/.tox/flake8-py27/bin/flake8 --doctests (exited with code 1)
10:56:40 flake8-py3 cannot reuse: no previous config /src/.tox/flake8-py3/.tox-config1

is easy to read

But it is hard to find in the log. The example in description is also easy to read, but it takes a while to find the issue

But it is hard to find in the log. The example in description is also easy to read, but it takes a while to find the issue

Just looking above of the read line.

Any idea to implement a better way?

Seems to me what is hard to read and what isn't is a subjective opinion. These kinds of tickets are hard to ever resolve, especially without a concrete suggestion what to change. It's similar to tickets about design that ask to "make it look more modern".

The goal of this task is clear. One does not want to look 5 minutes into the log to find what's wrong. The output should be either at the end or somehow marked/highlighted inbetween the noise

We could implement a maintenance bot which copies the related messages to gerrit. But a lot of work. Seems easier to give a hint to the developer during review process especially for newbies.

The issue is this clutter:

13:10:31 ERROR: InvocationError for command /src/.tox/flake8-py3/bin/flake8 --doctests (exited with code 1)
13:10:31 flake8-pypy cannot reuse: no previous config /src/.tox/flake8-pypy/.tox-config1
13:10:31 flake8-pypy create: /src/.tox/flake8-pypy
13:10:31 [240] /src/.tox$ /usr/bin/python3 -m virtualenv --no-download --python /usr/bin/pypy flake8-pypy >flake8-pypy/log/flake8-pypy-0.log
13:10:36 flake8-pypy installdeps: .[flake8]
13:10:36 [249] /src$ /src/.tox/flake8-pypy/bin/python -m pip install '.[flake8]' >.tox/flake8-pypy/log/flake8-pypy-1.log
13:10:44 flake8-pypy develop-inst: /src
13:10:44 write config to /src/.tox/flake8-pypy/.tox-config1 as '49b36c6f6174af633cf2f865d73a427b /usr/bin/pypy\n3.10.0 0 1 0\n00000000000000000000000000000000 .[flake8]'
13:10:44 [263] /src$ /src/.tox/flake8-pypy/bin/python -m pip install --exists-action w -e . >.tox/flake8-pypy/log/flake8-pypy-2.log
13:10:47 [277] /src$ /src/.tox/flake8-pypy/bin/python -m pip freeze >.tox/flake8-pypy/log/flake8-pypy-3.log
13:10:47 flake8-pypy installed: DEPRECATION: A future version of pip will drop support for Python 2.7.,certifi==2019.11.28,cffi==1.9.0,chardet==3.0.4,configparser==4.0.2,entrypoints==0.3,enum34==1.1.10,flake8==3.7.9,flake8-coding==1.3.2,flake8-comprehensions==1.4.1,flake8-docstrings==1.5.0,flake8-future-import==0.4.6,flake8-mock==0.3,flake8-no-u-prefixed-strings==0.2,flake8-polyfill==1.0.2,flake8-print==3.1.4,flake8-quotes==3.0.0,flake8-string-format==0.3.0,flake8-tuple==0.4.1,functools32==3.2.3.post2,greenlet==0.4.10,hacking==2.0.0,idna==2.9,ipaddress==1.0.23,mccabe==0.6.1,pathlib2==2.3.5,pep8-naming==0.10.0,pycodestyle==2.5.0,pydocstyle==3.0.0,pyflakes==2.1.1,# Editable Git install with no remote (pywikibot==3.0.20200329.dev0),-e /src,readline==6.2.4.1,requests==2.23.0,scandir==1.10.0,six==1.14.0,snowballstemmer==2.0.0,typing==3.7.4.1,urllib3==1.25.8
13:10:47 flake8-pypy run-test-pre: PYTHONHASHSEED='2436169504'
13:10:47 flake8-pypy run-test: commands[0] | flake8 --doctests
13:10:47 [279] /src$ /src/.tox/flake8-pypy/bin/flake8 --doctests

between each of 4 tests in docker test results like:

13:11:12 ./pywikibot/page/__init__.py:5855:1: D400 First line should end with a period

These 4 lines are hard to find between 4 blocks of clutter like above.

If colours would only highlight the resulting line(s), it might be slightly better, yes.

Another possibility would be to do that stuff like installing dependencies before tests on all 4 environments and after that run tests. Another possibility would be to move results to the end before finishing.

Another issue is that the clutter is in bold font, whereas the result is not bold. Which makes the issue even worse.

Change 592483 had a related patch set uploaded (by Xqt; owner: Xqt):
[pywikibot/core@master] [tests] Add flake8-color to provide a color format string

https://gerrit.wikimedia.org/r/592483

Change 592483 merged by jenkins-bot:
[pywikibot/core@master] [tests] Add flake8-color to provide a color format string

https://gerrit.wikimedia.org/r/592483

Change 262696 abandoned by Xqt:
[pywikibot/core@master] Colourise tox flake8 output

Reason:
already solved with flake8-colors

https://gerrit.wikimedia.org/r/262696

Pppery subscribed.

Can this be closed as resolved given that the patch was merged?

This is still open because flake8-colours was merged to flake8 but does not work with the CI (Jenkins) output any longer.

In a lot of case the tools check whether the standard input is a TTY (sys.stdint.isatty()) and disable color output when it is not. On CI the containers are spawned without a pseudo tty allocate (docker run -t) cause some other tooling might then prompt the user for some input (example: Really proceed [Y\n]), which Jenkins can't reply to (it is not an AI yet).

And indeed looking at the tip of flake8 code:

class BaseFormatter:
...
        self.color = options.color == "always" or (
            options.color == "auto"
            and sys.stdout.isatty()
            and _windows_color.terminal_supports_color
        )

To get coloring one should thus use flake8 --color=always. Then looking at pywikibot/core it has:

tox.ini
[flake8]
color = always

Which I am guessing is not taken in account? If I run flake8 with some increased verbosity:

$ tox -e flake8-py39 -- -vvvv pywikibot/echo.py |grep -i colo
flake8.options.manager    MainProcess    124 DEBUG    Registered option "Option(--color, default='auto', choices=('auto', 'always', 'never'), help='Whether to use color in output.  Defaults to `%(default)s`.')".
flake8.options.config     MainProcess    127 DEBUG    Option "color" is not registered. Ignoring.
                                                      ^^^^^^^^^^^^^^

It shows a few others:

flake8.options.config     MainProcess    129 DEBUG    Option "enable-extensions" is not registered. Ignoring.
flake8.options.config     MainProcess    129 DEBUG    Option "color" is not registered. Ignoring.
flake8.options.config     MainProcess    129 DEBUG    Option "ignore_regex" is not registered. Ignoring.

They all three come from the repository tox.ini:

tox.ini
[flake8]
enable-extensions = H203,H204,H205,N818
color = always
ignore_regex=:keyword

And if I had a hashar_option = hack the same shows up for it Option "hashar_option" is not registered. Ignoring..

So it looks like flake8 has a bug which is that it does not recognizes some options from tox.ini, possibly cause they got renamed (color > colour?) or they somehow forgot to handle them.

For the releng/tox images, the entry point invokes tox with PY_COLORS=1 which I thing was for pip and nose test maybe but that is not recognized by flake8

Short of figuring the issue in flake8, the command line can be passed --color=always and that should work on CI. One can then confirm locally by invoking tox -e flake8-p39|cat against a workspace that has some flake8 issues.

The documentation says that the color option cannot be specified in config files, so it must be specified on the command line.

Change 904584 had a related patch set uploaded (by JJMC89; author: JJMC89):

[pywikibot/core@master] move flake8 color option from config file to command line

https://gerrit.wikimedia.org/r/904584

Change 904584 merged by Xqt:

[pywikibot/core@master] move flake8 color option from config file to command line

https://gerrit.wikimedia.org/r/904584

Change 904459 had a related patch set uploaded (by Xqt; author: Xqt):

[pywikibot/core@master] [flake8] Add format line for flake8 color

https://gerrit.wikimedia.org/r/904459

The documentation says that the color option cannot be specified in config files, so it must be specified on the command line.

Great finding! Thank you very much ;)

Change 904459 merged by jenkins-bot:

[pywikibot/core@master] [flake8] Add format line for flake8 color which we hat for flake8-color

https://gerrit.wikimedia.org/r/904459

Xqt claimed this task.
Xqt removed a project: Patch-For-Review.

I close this after flake8 errors are colorised again. For other test the result can be found at the end of the test. Some log entries (e.g. duplicates) were removed previously. Other log entries are essential for debugging and cannot be omitted.

Xqt removed Xqt as the assignee of this task.Apr 2 2023, 9:32 PM