Skip to content

Commit

Permalink
fix test_conda_downgrade by installing cph in test prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
msarahan committed Apr 18, 2019
1 parent e9b2eb3 commit 1d93f1c
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions tests/test_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -2563,25 +2563,23 @@ def test_conda_downgrade(self):
}, stack_callback=conda_tests_ctxt_mgmt_def_pol):
# py_ver = str(sys.version_info[0])
py_ver = "3"
with make_temp_env("conda=4.5.12", "python=" + py_ver, use_restricted_unicode=True,
with make_temp_env("conda=4.5.12", "conda-package-handling", "python=" + py_ver, use_restricted_unicode=True,
name = '_' + str(uuid4())[:8]) as prefix: # rev 0
# See comment in test_init_dev_and_NoBaseEnvironmentError.
python_exe = join(prefix, 'python.exe') if on_win else join(prefix, 'bin', 'python')
conda_exe = join(prefix, 'Scripts', 'conda.exe') if on_win else join(prefix, 'bin', 'conda')
py_co = [python_exe, "-m", "conda"]
assert package_is_installed(prefix, "conda=4.5.12")

# runs our current version of conda to install into the foreign env
run_command(Commands.INSTALL, prefix, "lockfile") # rev 1
assert package_is_installed(prefix, "lockfile")

# runs the conda in the env to install something new into the env
subprocess_call(py_co + ["install", "-yp", prefix, "itsdangerous"], path=prefix) # rev 2
run_command(Commands.RUN, prefix, conda_exe, "install", "-yp", prefix, "itsdangerous") #rev 2
PrefixData._cache_.clear()
assert package_is_installed(prefix, "itsdangerous")

# downgrade the version of conda in the env
subprocess_call_with_clean_env(py_co + ["install", "-yp", prefix, "conda=4.5.11"], path=prefix) # rev 3
run_command(Commands.RUN, prefix, conda_exe, "install", "-yp", prefix, "conda=4.5.11") # rev 3
PrefixData._cache_.clear()
assert not package_is_installed(prefix, "conda=4.5.12")

Expand All @@ -2596,14 +2594,14 @@ def test_conda_downgrade(self):
assert package_is_installed(prefix, "conda=4.5.12")

# use the conda in the env to revert to a previous state
subprocess_call_with_clean_env(py_co + ["install", "-yp", prefix, "--rev", "1"], path=prefix)
subprocess_call_with_clean_env([conda_exe, "install", "-yp", prefix, "--rev", "1"], path=prefix)
PrefixData._cache_.clear()
assert not package_is_installed(prefix, "itsdangerous")
PrefixData._cache_.clear()
assert package_is_installed(prefix, "conda=4.5.12")
assert package_is_installed(prefix, "python=" + py_ver)

result = subprocess_call_with_clean_env(py_co + ["info", "--json"])
result = subprocess_call_with_clean_env([conda_exe, "info", "--json"])
conda_info = json.loads(result.stdout)
assert conda_info["conda_version"] == "4.5.12"

Expand Down

0 comments on commit 1d93f1c

Please sign in to comment.