def test_fetchrepodata_httperror(self): with pytest.raises(CondaHTTPError) as execinfo: url = DEFAULT_CHANNEL_ALIAS user = remove_binstar_tokens(url).split(DEFAULT_CHANNEL_ALIAS)[1].split("/")[0] msg = 'Could not find anaconda.org user %s' % user filename = 'repodata.json' responses.add(responses.GET, url+filename, body='{"error": "not found"}', status=404, content_type='application/json') fetch_repodata(url) assert msg in str(execinfo), str(execinfo)
def test_fetchrepodate_connectionerror(self): with pytest.raises(CondaRuntimeError) as execinfo: url = "http://240.0.0.0/" msg = "Connection error:" fetch_repodata(url) assert msg in str(execinfo)
print sources print env_lts import conda.plan import conda_build.config import conda from conda.api import get_index from conda.fetch import fetch_repodata url = 'file:///data/local/itpe/miniconda/conda-builds-scientific_software_stack_since_05_15/linux-64/' repo = fetch_repodata(url) from conda.resolve import Resolve, MatchSpec print repo r = Resolve(repo['packages']) r.solve(env_lts['packages'], features=set()) r.solve2(env_lts['packages'], features=set()) # conda.api.fetch_repodata is the underlying index loader. #index = get_index(channel_urls=channel_urls,