def test_dash_c_usage_replacing_python(self): # Regression test for #2606 with make_temp_env("-c conda-forge python=3.5") as prefix: assert exists(join(prefix, PYTHON_BINARY)) run_command(Commands.INSTALL, prefix, "decorator") assert_package_is_installed(prefix, 'conda-forge::python-3.5') with make_temp_env("--clone", prefix) as clone_prefix: assert_package_is_installed(clone_prefix, 'conda-forge::python-3.5') assert_package_is_installed(clone_prefix, "decorator") # Regression test for 2645 fn = glob(join(prefix, 'conda-meta', 'python-3.5*.json'))[-1] with open(fn) as f: data = json.load(f) for field in ('url', 'channel', 'schannel'): if field in data: del data[field] with open(fn, 'w') as f: json.dump(data, f) linked_data_.clear() with make_temp_env("-c conda-forge --clone", prefix) as clone_prefix: assert_package_is_installed(clone_prefix, 'python-3.5') assert_package_is_installed(clone_prefix, 'decorator')
def test_tarball_install_and_bad_metadata(self): with make_temp_env("python flask=0.10.1 --json") as prefix: assert_package_is_installed(prefix, 'flask-0.10.1') flask_data = [ p for p in itervalues(linked_data(prefix)) if p['name'] == 'flask' ][0] run_command(Commands.REMOVE, prefix, 'flask') assert not package_is_installed(prefix, 'flask-0.10.1') assert_package_is_installed(prefix, 'python') flask_fname = flask_data['fn'] tar_old_path = join(PackageCache.first_writable().pkgs_dir, flask_fname) assert isfile(tar_old_path) # regression test for #2886 (part 1 of 2) # install tarball from package cache, default channel run_command(Commands.INSTALL, prefix, tar_old_path) assert_package_is_installed(prefix, 'flask-0.') # regression test for #2626 # install tarball with full path, outside channel tar_new_path = join(prefix, flask_fname) copyfile(tar_old_path, tar_new_path) run_command(Commands.INSTALL, prefix, tar_new_path) assert_package_is_installed(prefix, 'flask-0') # regression test for #2626 # install tarball with relative path, outside channel run_command(Commands.REMOVE, prefix, 'flask') assert not package_is_installed(prefix, 'flask-0.10.1') tar_new_path = relpath(tar_new_path) run_command(Commands.INSTALL, prefix, tar_new_path) assert_package_is_installed(prefix, 'flask-0.') # regression test for #2886 (part 2 of 2) # install tarball from package cache, local channel run_command(Commands.REMOVE, prefix, 'flask', '--json') assert not package_is_installed(prefix, 'flask-0') run_command(Commands.INSTALL, prefix, tar_old_path) # The last install was from the `local::` channel assert_package_is_installed(prefix, 'flask-') # regression test for #2599 linked_data_.clear() flask_metadata = glob( join(prefix, 'conda-meta', flask_fname[:-8] + '.json'))[-1] bad_metadata = join(prefix, 'conda-meta', 'flask.json') copyfile(flask_metadata, bad_metadata) assert not package_is_installed(prefix, 'flask', exact=True) assert_package_is_installed(prefix, 'flask-0.')
def test_tarball_install_and_bad_metadata(self): with make_temp_env("python flask=0.10.1 --json") as prefix: assert_package_is_installed(prefix, 'flask-0.10.1') flask_data = [p for p in itervalues(linked_data(prefix)) if p['name'] == 'flask'][0] run_command(Commands.REMOVE, prefix, 'flask') assert not package_is_installed(prefix, 'flask-0.10.1') assert_package_is_installed(prefix, 'python') flask_fname = flask_data['fn'] tar_old_path = join(PackageCache.first_writable().pkgs_dir, flask_fname) assert isfile(tar_old_path) # regression test for #2886 (part 1 of 2) # install tarball from package cache, default channel run_command(Commands.INSTALL, prefix, tar_old_path) assert_package_is_installed(prefix, 'flask-0.') # regression test for #2626 # install tarball with full path, outside channel tar_new_path = join(prefix, flask_fname) copyfile(tar_old_path, tar_new_path) run_command(Commands.INSTALL, prefix, tar_new_path) assert_package_is_installed(prefix, 'flask-0') # regression test for #2626 # install tarball with relative path, outside channel run_command(Commands.REMOVE, prefix, 'flask') assert not package_is_installed(prefix, 'flask-0.10.1') tar_new_path = relpath(tar_new_path) run_command(Commands.INSTALL, prefix, tar_new_path) assert_package_is_installed(prefix, 'flask-0.') # regression test for #2886 (part 2 of 2) # install tarball from package cache, local channel run_command(Commands.REMOVE, prefix, 'flask', '--json') assert not package_is_installed(prefix, 'flask-0') run_command(Commands.INSTALL, prefix, tar_old_path) # The last install was from the `local::` channel assert_package_is_installed(prefix, 'flask-') # regression test for #2599 linked_data_.clear() flask_metadata = glob(join(prefix, 'conda-meta', flask_fname[:-8] + '.json'))[-1] bad_metadata = join(prefix, 'conda-meta', 'flask.json') copyfile(flask_metadata, bad_metadata) assert not package_is_installed(prefix, 'flask', exact=True) assert_package_is_installed(prefix, 'flask-0.')