(
empty_env: Path,
monkeypatch: MonkeyPatch,
capsys: CaptureFixture,
force_uppercase_boolean: bool,
)
| 1257 | @pytest.mark.skipif(not on_win, reason="cmd.exe only on Windows") |
| 1258 | @pytest.mark.parametrize("force_uppercase_boolean", [True, False]) |
| 1259 | def test_cmd_exe_basic( |
| 1260 | empty_env: Path, |
| 1261 | monkeypatch: MonkeyPatch, |
| 1262 | capsys: CaptureFixture, |
| 1263 | force_uppercase_boolean: bool, |
| 1264 | ) -> None: |
| 1265 | monkeypatch.setenv("CONDA_ENVVARS_FORCE_UPPERCASE", force_uppercase_boolean) |
| 1266 | reset_context() |
| 1267 | assert context.envvars_force_uppercase == force_uppercase_boolean |
| 1268 | |
| 1269 | activator = CmdExeActivator() |
| 1270 | make_dot_d_files(empty_env, activator.script_extension) |
| 1271 | |
| 1272 | err = main_sourced("shell.cmd.exe", "activate", str(empty_env)) |
| 1273 | activate_result, stderr = capsys.readouterr() |
| 1274 | assert not stderr |
| 1275 | assert not err |
| 1276 | |
| 1277 | activate_data = Path(activate_result).read_text() |
| 1278 | rm_rf(activate_result) |
| 1279 | |
| 1280 | new_path_parts = activator._add_prefix_to_path(empty_env) |
| 1281 | conda_exe_export, unset_vars = get_scripts_export_unset_vars(activator) |
| 1282 | activate1 = activator.path_conversion( |
| 1283 | join(empty_env, "etc", "conda", "activate.d", "activate1.bat") |
| 1284 | ) |
| 1285 | assert activate_data == ( |
| 1286 | f"{unset_vars}\n" |
| 1287 | f"PROMPT={get_prompt(empty_env)}\n" |
| 1288 | f"PATH={activator.pathsep_join(new_path_parts)}\n" |
| 1289 | f"CONDA_PREFIX={activator.path_conversion(empty_env)}\n" |
| 1290 | f"CONDA_SHLVL=1\n" |
| 1291 | f"CONDA_DEFAULT_ENV={empty_env}\n" |
| 1292 | f"CONDA_PROMPT_MODIFIER={get_prompt_modifier(empty_env)}\n" |
| 1293 | f"{conda_exe_export}\n" |
| 1294 | f"_CONDA_SCRIPT={activate1}\n" |
| 1295 | ) |
| 1296 | |
| 1297 | monkeypatch.setenv("CONDA_PREFIX", empty_env) |
| 1298 | monkeypatch.setenv("CONDA_SHLVL", "1") |
| 1299 | monkeypatch.setenv("PATH", os.pathsep.join((*new_path_parts, os.environ["PATH"]))) |
| 1300 | |
| 1301 | activator = CmdExeActivator() |
| 1302 | err = main_sourced("shell.cmd.exe", "reactivate") |
| 1303 | reactivate_result, stderr = capsys.readouterr() |
| 1304 | assert not stderr |
| 1305 | assert not err |
| 1306 | |
| 1307 | reactivate_data = Path(reactivate_result).read_text() |
| 1308 | rm_rf(reactivate_result) |
| 1309 | |
| 1310 | new_path_parts = activator._replace_prefix_in_path(empty_env, empty_env) |
| 1311 | conda_exe_export, unset_vars = get_scripts_export_unset_vars(activator) |
| 1312 | activate1 = activator.path_conversion( |
| 1313 | join( |
| 1314 | empty_env, |
| 1315 | "etc", |
| 1316 | "conda", |
nothing calls this directly
no test coverage detected
searching dependent graphs…