Skip to content

Commit ae2de68

Browse files
tests/test_fixtures: set NOCOLOR=1 allowing plain assertions in pytest --help
argparse [1] enables colors by default since Python 3.14. This breaks asserting that the help text contains "--lg-coordinator=COORDINATOR_ADDRESS" due to escape codes and a different output format. Fix that by passing NO_COLOR=1 in the test's environment. [1] https://docs.python.org/3.14/library/argparse.html#color Signed-off-by: Bastian Krause <[email protected]>
1 parent e9e43aa commit ae2de68

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tests/test_fixtures.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,11 @@ def test_env_with_junit(short_env, short_test, tmpdir):
6262
spawn.close()
6363
assert spawn.exitstatus == 0
6464

65-
def test_help(short_test):
65+
def test_help(short_test, monkeypatch):
66+
# argparse in Python >= 3.14 enables colored output by default,
67+
# disable that to allow argument assertions below
68+
monkeypatch.setenv("NO_COLOR", "1")
69+
6670
with pexpect.spawn(f'pytest --help {short_test}') as spawn:
6771
spawn.expect(pexpect.EOF)
6872
assert b'--lg-coordinator=COORDINATOR_ADDRESS' in spawn.before

0 commit comments

Comments
 (0)