def test_resolve_dependencies_with_conda_api_mock_raises_error(monkeypatch): def mock_resolve_dependencies(pkgs, platform, channels): raise conda_api.CondaError("nope") monkeypatch.setattr('anaconda_project.internal.conda_api.resolve_dependencies', mock_resolve_dependencies) manager = DefaultCondaManager(frontend=NullFrontend()) with pytest.raises(CondaManagerError) as excinfo: manager.resolve_dependencies(['bokeh'], channels=(), platforms=(conda_api.current_platform(), )) assert 'Error resolving for' in str(excinfo.value)
def test_resolve_dependencies_with_actual_conda(): manager = DefaultCondaManager(frontend=NullFrontend()) lock_set = manager.resolve_dependencies(['bokeh'], channels=(), platforms=(conda_api.current_platform(), )) specs = lock_set.package_specs_for_current_platform pprint(specs) names = [conda_api.parse_spec(spec).name for spec in specs] assert 'bokeh' in names assert len(specs) > 5 # 5 is an arbitrary number of deps that surely bokeh has
def test_resolve_dependencies_with_conda_api_mock(monkeypatch): def mock_resolve_dependencies(pkgs, platform, channels): return [('bokeh', '0.12.4', '0'), ('thing', '1.0', '1')] monkeypatch.setattr('anaconda_project.internal.conda_api.resolve_dependencies', mock_resolve_dependencies) manager = DefaultCondaManager(frontend=NullFrontend()) lock_set = manager.resolve_dependencies(['bokeh'], channels=(), platforms=(conda_api.current_platform(), )) assert lock_set.package_specs_for_current_platform == ('bokeh=0.12.4=0', 'thing=1.0=1')