Stop two tests failing on what is around them

The macOS path test set XDG_CONFIG_HOME to "/c" and asserted that "/c" was nowhere in the answer, but the home these run under is a mkdtemp path, so any TMPDIR with a "/c" in it failed the test. macOS is exactly where that happens: its temporary directories are /var/folders/<two letters>/, and one letter in thirty-six starts with c. The needle is now a word no directory can be called.

The other is the `ask` verb reading what was piped into it. Nothing was, but the runner's own stdin is not nothing either, so the verb read whatever the runner left there. It now reads an empty stream, whichever runner is in use.
This commit is contained in:
2026-09-05 09:47:50 +03:00
parent fff9cd1c55
commit fb80d85332
2 changed files with 10 additions and 2 deletions
+5
View File
@@ -9,6 +9,7 @@ socket is faked, and everything that runs locally runs for real.
import contextlib
import io
import json
import sys
import unittest
import webbrowser
from typing import ClassVar
@@ -668,7 +669,11 @@ class WithoutAnInstance(DikteTest):
def run_verb(self, argv):
# launch_gui replaces this process with the application, so it never
# comes back in real use and must not be allowed to here.
# `ask` with no text reads what was piped in, and the runner's own
# stdin is not that: under pytest it is an object that refuses to be
# read at all.
with mock.patch.object(ipc, "send", return_value=None), \
mock.patch.object(sys, "stdin", io.StringIO()), \
mock.patch.object(cli, "launch_gui") as launch, \
captured() as (out, err):
code = cli.run(argv)