Skip to content

Tox now more particular about FORCE_COLOR #74

@jaraco

Description

@jaraco

Starting with tox 4, it seems it no longer is sloppy about the values for FORCE_COLOR, and now CI is failing because it's validating the value to some more reasonable values. From a CI run in a derivative project:

Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.8.15/x64/bin/tox", line 8, in <module>
    sys.exit(run())
  File "/opt/hostedtoolcache/Python/3.8.15/x64/lib/python3.8/site-packages/tox/run.py", line 19, in run
    result = main(sys.argv[1:] if args is None else args)
  File "/opt/hostedtoolcache/Python/3.8.15/x64/lib/python3.8/site-packages/tox/run.py", line 38, in main
    state = setup_state(args)
  File "/opt/hostedtoolcache/Python/3.8.15/x64/lib/python3.8/site-packages/tox/run.py", line 53, in setup_state
    options = get_options(*args)
  File "/opt/hostedtoolcache/Python/3.8.15/x64/lib/python3.8/site-packages/tox/config/cli/parse.py", line 38, in get_options
    guess_verbosity, log_handler, source = _get_base(args)
  File "/opt/hostedtoolcache/Python/3.8.15/x64/lib/python3.8/site-packages/tox/config/cli/parse.py", line 47, in _get_base
    tox_parser = ToxParser.base()
  File "/opt/hostedtoolcache/Python/3.8.15/x64/lib/python3.8/site-packages/tox/config/cli/parser.py", line 228, in base
    return cls(add_help=False, root=True)
  File "/opt/hostedtoolcache/Python/3.8.15/x64/lib/python3.8/site-packages/tox/config/cli/parser.py", line 151, in __init__
    self._add_base_options()
  File "/opt/hostedtoolcache/Python/3.8.15/x64/lib/python3.8/site-packages/tox/config/cli/parser.py", line 242, in _add_base_options
    add_core_arguments(self)
  File "/opt/hostedtoolcache/Python/3.8.15/x64/lib/python3.8/site-packages/tox/config/cli/parser.py", line 322, in add_core_arguments
    add_color_flags(parser)
  File "/opt/hostedtoolcache/Python/3.8.15/x64/lib/python3.8/site-packages/tox/config/cli/parser.py", line 295, in add_color_flags
    elif converter.to_bool(os.environ.get("FORCE_COLOR", "")):
  File "/opt/hostedtoolcache/Python/3.8.15/x64/lib/python3.8/site-packages/tox/config/loader/str_convert.py", line 90, in to_bool
    raise TypeError(f"value {value} cannot be transformed to bool, valid: {', '.join(StrConvert.VALID_BOOL)}")
TypeError: value -106 cannot be transformed to bool, valid: , 0, 1, false, no, off, on, true, yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions