MCPcopy
hub / github.com/conda/conda / test_replace_prefix_in_path_2

Function test_replace_prefix_in_path_2

tests/test_activate.py:388–404  ·  view source on GitHub ↗
(monkeypatch: MonkeyPatch)

Source from the content-addressed store, hash-verified

386
387@pytest.mark.skipif(not on_win, reason="windows-specific test")
388def test_replace_prefix_in_path_2(monkeypatch: MonkeyPatch):
389 path1 = join("c:\\", "temp", "6663 31e0")
390 path2 = join("c:\\", "temp", "6663 31e0", "envs", "charizard")
391 one_more = join("d:\\", "one", "more")
392 # old_prefix: c:\users\builder\appdata\local\temp\6663 31e0
393 # new_prefix: c:\users\builder\appdata\local\temp\6663 31e0\envs\charizard
394 activator = CmdExeActivator()
395 old_path = activator.pathsep_join(activator._add_prefix_to_path(path1))
396 old_path = one_more + ";" + old_path
397
398 monkeypatch.setenv("PATH", old_path)
399 activator = PosixActivator()
400 path_elements = activator._replace_prefix_in_path(path1, path2)
401
402 assert path_elements[0] == win_path_to_unix(one_more)
403 assert path_elements[1] == win_path_to_unix(next(activator._get_path_dirs(path2)))
404 assert len(path_elements) == len(old_path.split(";"))
405
406
407def test_default_env(tmp_path: Path):

Callers

nothing calls this directly

Calls 8

CmdExeActivatorClass · 0.90
PosixActivatorClass · 0.90
win_path_to_unixFunction · 0.90
joinFunction · 0.85
_add_prefix_to_pathMethod · 0.80
_get_path_dirsMethod · 0.80
splitMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…