mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-24 12:49:03 -05:00
fix: keep install tests off the host environment
On a WSL host install.main() reads USERPROFILE, APPDATA and the rest through cmd.exe and sets them in os.environ. Two selection tests left them set, and the detection test, run later in the jsonschema-free suite, found a Scoop folder no registry rule publishes. The selection tests restore os.environ, and the detection test clears the Windows variables it does not set.
This commit is contained in:
1 parent
e7a64d6a08
commit
0ecd830028
2 files changed
+7
-1
No files matched your search
@@ -1045,6 +1045,9 @@ class DetectionFollowsTheRegistry(unittest.TestCase):
|
||||
env = {
|
||||
"HOME": str(root / "home"), "APPDATA": str(root / "appdata"),
|
||||
"ProgramFiles": str(root / "pf"), "ProgramFiles(x86)": str(root / "pf86"),
|
||||
# Not the host's: a WSL session can hold them.
|
||||
"USERPROFILE": "", "LOCALAPPDATA": "", "ProgramData": "",
|
||||
"SCOOP": "", "SCOOP_GLOBAL": "",
|
||||
}
|
||||
|
||||
def expand(text: str) -> str:
|
||||
|
||||
@@ -362,7 +362,10 @@ class DecliningTheSizePointsAtTheChoice(unittest.TestCase):
|
||||
def _run(self, answers: list[str], *options: str) -> str:
|
||||
replies = iter(answers)
|
||||
out = io.StringIO()
|
||||
with FakeRepository() as repo, \
|
||||
# main() on a WSL host reads the Windows variables through cmd.exe
|
||||
# and sets them in os.environ: restored here, they leaked into every
|
||||
# later test (USERPROFILE added a Scoop folder to detection).
|
||||
with FakeRepository() as repo, mock.patch.dict(os.environ), \
|
||||
mock.patch.object(sys, "argv", ["install.py", "--platform", "retroarch",
|
||||
"--dest", str(repo.dest), *options]), \
|
||||
mock.patch.object(install, "MANIFEST_URL",
|
||||
|
||||
Reference in new issue
Block a user