diff options
author | 2022-11-19 15:55:47 +0200 | |
---|---|---|
committer | 2022-11-19 15:55:47 +0200 | |
commit | d77990efa1b8a2151471e8e112b36b048b25ea54 (patch) | |
tree | 442beb29a3a5c46c490b8a66258095a9c0c775e2 /tests | |
parent | start work on 0.10.19 (diff) | |
download | pkgcheck-d77990efa1b8a2151471e8e112b36b048b25ea54.tar.gz pkgcheck-d77990efa1b8a2151471e8e112b36b048b25ea54.tar.bz2 pkgcheck-d77990efa1b8a2151471e8e112b36b048b25ea54.zip |
scan: add support for NOCOLOR to disable colors
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/scripts/test_pkgcheck_scan.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/scripts/test_pkgcheck_scan.py b/tests/scripts/test_pkgcheck_scan.py index 8b8113e7..6c1600f8 100644 --- a/tests/scripts/test_pkgcheck_scan.py +++ b/tests/scripts/test_pkgcheck_scan.py @@ -264,6 +264,21 @@ class TestPkgcheckScanParseArgs: assert options.jobs == expected_jobs assert options.tasks == 5 * expected_jobs + def test_no_color(self, parser, tmp_path): + (config_file := tmp_path / 'config').write_text(textwrap.dedent('''\ + [DEFAULT] + color = true + ''')) + + args = ('scan', '--config', str(config_file)) + assert parser.parse_args(args).color is True + with os_environ(NOCOLOR='1'): + # NOCOLOR overrides config file + assert parser.parse_args(args).color is False + # cmd line option overrides NOCOLOR + assert parser.parse_args([*args, '--color', 'n']).color is False + assert parser.parse_args([*args, '--color', 'y']).color is True + class TestPkgcheckScanParseConfigArgs: |