test_ok2/testing
Michał Górny 52db918a27
Fix handling empty values of NO_COLOR and FORCE_COLOR (#11712)
* Fix handling empty values of NO_COLOR and FORCE_COLOR

Fix handling NO_COLOR and FORCE_COLOR environment variables to correctly
be ignored when they are set to an empty value, as defined
in the specification:

> Command-line software which adds ANSI color to its output by default
> should check for a NO_COLOR environment variable that, when present
> *and not an empty string* (regardless of its value), prevents
> the addition of ANSI color.

(emphasis mine, https://no-color.org/)

The same is true of FORCE_COLOR, https://force-color.org/.

* Streamline testing for FORCE_COLOR and NO_COLOR

Streamline the tests for FORCE_COLOR and NO_COLOR variables, and cover
all possible cases (unset, set to empty, set to "1").  Combine the two
assert functions into one taking boolean parameters.  Mock file.isatty
in all circumstances to ensure that the environment variables take
precedence over the fallback value resulting from isatty check (or that
the fallback is actually used, in the case of both FORCE_COLOR
and NO_COLOR being unset).
2023-12-23 10:12:13 +02:00
..
_py XFAIL TestLocalPath.test_make_numbered_dir_multiprocess_safe (#11611) 2023-11-14 11:41:35 -03:00
code pytester: use monkeypatch.chdir() for dir changing 2023-09-25 11:31:09 +03:00
example_scripts nodes,python: mark abstract node classes as ABCs 2023-12-07 16:41:07 +02:00
examples fix bug in test for issue 519 2021-03-07 15:01:39 +01:00
freeze testing: fix some docstring issues 2020-08-03 10:10:43 +03:00
io Fix handling empty values of NO_COLOR and FORCE_COLOR (#11712) 2023-12-23 10:12:13 +02:00
logging Add new filtering() method to LogCaptureFixture class (#11625) 2023-11-24 09:38:34 -03:00
plugins_integration build(deps): Bump anyio[curio,trio] in /testing/plugins_integration (#11717) 2023-12-18 06:33:59 +01:00
python Separate the various parts of the error report with newlines (#11659) 2023-12-06 09:25:00 +00:00
acceptance_test.py Duplicated parameters in parametrize marker (#11489) 2023-10-08 10:26:31 -07:00
conftest.py Reset color-related envvars for testing (#11638) 2023-11-26 11:09:18 -03:00
deprecated_test.py nodes,python: mark abstract node classes as ABCs 2023-12-07 16:41:07 +02:00
test_argcomplete.py pytest-dev#8204 migrate some tests to tmp_path fixture (#8209) 2021-01-01 17:25:11 +02:00
test_assertion.py Add syntactic highlights to the error explanations (#11661) 2023-12-21 17:11:56 +00:00
test_assertrewrite.py Add verbosity_assertions and config.get_verbosity 2023-11-19 11:56:29 -03:00
test_cacheprovider.py Add encoding in more tests 2023-06-20 04:55:40 -07:00
test_capture.py Add encoding in more tests 2023-06-20 04:55:40 -07:00
test_collection.py nodes,python: mark abstract node classes as ABCs 2023-12-07 16:41:07 +02:00
test_compat.py Drop Python 3.7 2023-06-30 14:55:42 -07:00
test_config.py testing: remove a no longer necessary skip 2023-11-30 19:53:31 +02:00
test_conftest.py config: split _getconftestmodules and _loadconftestmodules 2023-08-01 09:46:17 +03:00
test_debugging.py Test fix 2022-10-14 13:53:06 -04:00
test_doctest.py Fix doctest collection of `functools.cached_property` objects. 2023-08-16 00:55:16 -06:00
test_entry_points.py Drop Python 3.7 2023-06-30 14:55:42 -07:00
test_error_diffs.py Improve the full diff by having more consistent indentation in the PrettyPrinter (#11571) 2023-11-27 16:47:18 +02:00
test_faulthandler.py Only re-enable fauthandler during unconfigure if it was enabled before 2021-01-25 12:28:00 -03:00
test_findpaths.py Fix bug where file system root was erroneously be used as rootdir on Windows 2022-11-23 14:46:00 -03:00
test_helpconfig.py Document the --code-highlight default (#9883) 2022-05-31 16:32:51 -03:00
test_junitxml.py Fix user_properties not saved to XML if fixture errors during teardown 2023-09-03 14:33:54 -03:00
test_legacypath.py fixtures: make FixtureRequest abstract, add TopRequest subclass 2023-08-12 11:55:08 +03:00
test_link_resolve.py Add encoding in more tests 2023-06-20 04:55:40 -07:00
test_main.py Fix crash when passing a very long cmdline argument (#11404) 2023-09-07 12:49:25 -03:00
test_mark.py Switch to new-style pluggy hook wrappers 2023-07-14 22:47:48 +03:00
test_mark_expression.py Support forwardslash characters in identifiers (#9249) 2021-11-01 08:54:18 +02:00
test_meta.py py36+: com2ann 2020-10-05 18:33:17 -07:00
test_monkeypatch.py Add encoding in more tests 2023-06-20 04:55:40 -07:00
test_nodes.py nodes,python: mark abstract node classes as ABCs 2023-12-07 16:41:07 +02:00
test_nose.py python: change `pytest pkg/__init__.py` to only collect the `__init__.py` Module 2023-06-23 20:42:50 +03:00
test_parseopt.py pytester: avoid EncodingWarning from `locale.getpreferredencoding` 2023-11-28 17:40:58 +02:00
test_pastebin.py fix typing issues in mypy 0.920 2021-12-21 20:42:32 -05:00
test_pathlib.py pytester: use monkeypatch.chdir() for dir changing 2023-09-25 11:31:09 +03:00
test_pluginmanager.py Fixes for typed pluggy 2023-08-26 22:13:24 +03:00
test_pytester.py pytester: use monkeypatch.chdir() for dir changing 2023-09-25 11:31:09 +03:00
test_python_path.py Switch to new-style pluggy hook wrappers 2023-07-14 22:47:48 +03:00
test_recwarn.py Change deprecated_call to handle FutureWarning (#11448) 2023-09-18 09:34:05 -03:00
test_reports.py Add encoding in more tests 2023-06-20 04:55:40 -07:00
test_runner.py Switch to new-style pluggy hook wrappers 2023-07-14 22:47:48 +03:00
test_runner_xunit.py [pre-commit.ci] pre-commit autoupdate (#8201) 2020-12-30 11:56:09 +02:00
test_scope.py Refactor internal scope handling by introducing Scope enum 2021-08-01 06:11:56 -03:00
test_session.py Add encoding in more tests 2023-06-20 04:55:40 -07:00
test_setuponly.py Migrate test_setuponly.py from testdir to pytester (#7959) 2020-10-29 09:55:30 +02:00
test_setupplan.py #7942 test_setupplan.py migrate from testdir to Pytester (#8004) 2020-11-07 09:29:45 -03:00
test_skipping.py fixtures: show test as skip location if skipped from an xunit setup function 2023-07-16 23:26:04 +03:00
test_stash.py Fix typos (#9424) 2021-12-27 09:23:15 -03:00
test_stepwise.py Add encoding in more tests 2023-06-20 04:55:40 -07:00
test_terminal.py Add syntactic highlights to the error explanations (#11661) 2023-12-21 17:11:56 +00:00
test_threadexception.py Drop Python 3.7 2023-06-30 14:55:42 -07:00
test_tmpdir.py Add encoding in more tests 2023-06-20 04:55:40 -07:00
test_unittest.py Switch to new-style pluggy hook wrappers 2023-07-14 22:47:48 +03:00
test_unraisableexception.py Explicit GC for PyPy, take 2 2023-06-30 20:33:12 -07:00
test_warning_types.py fix #10342: put location into warning exceptions 2022-10-06 11:44:05 +02:00
test_warnings.py Change PytestRemovedIn8Warning to error by default 2023-06-23 16:42:24 +03:00
typing_checks.py monkeypatch: add support for TypedDict (#11000) 2023-05-14 22:17:00 +03:00