hashar added a comment.

  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:
  
  name=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`:
  
  name=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//

TASK DETAIL
  https://phabricator.wikimedia.org/T117570

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: hashar
Cc: hashar, Dvorapa, zhuyifei1999, fgiunchedi, Xqt, jayvdb, gerritbot, 
Ricordisamoa, XZise, Aklapper, StudiesWorld, valhallasw, pywikibot-bugs-list, 
PotsdamLamb, Jyoo1011, JohnsonLee01, SHEKH, Peteosx1x, Dijkstra, Khutuck, 
Mgagat, Totolinototo3, Zkhalido, Zanziii, Sadisticturd, Viztor, Wenyi, Tbscho, 
MayS, Framawiki, Mdupont, JJMC89, Altostratus, binbot, Avicennasis, mys_721tx, 
Masti, Alchimista
_______________________________________________
pywikibot-bugs mailing list -- pywikibot-bugs@lists.wikimedia.org
To unsubscribe send an email to pywikibot-bugs-le...@lists.wikimedia.org

Reply via email to