diff --git a/conda_env/cli/common.py b/conda_env/cli/common.py index 8b98ca79943..0c24758e53e 100644 --- a/conda_env/cli/common.py +++ b/conda_env/cli/common.py @@ -60,13 +60,3 @@ def check_specs(prefix, specs, json=False, create=False): conda config --add create_default_packages PACKAGE_NAME """) raise CondaEnvException(msg) - - -def get_index_trap(*args, **kwargs): - """ - Retrieves the package index, but traps exceptions and reports them as - JSON if necessary. - """ - from conda.api import get_index - kwargs.pop('json') - return get_index(*args, **kwargs) diff --git a/conda_env/installers/conda.py b/conda_env/installers/conda.py index dc8fc3c26fa..faa842d5f58 100644 --- a/conda_env/installers/conda.py +++ b/conda_env/installers/conda.py @@ -2,8 +2,9 @@ from conda.cli import common from conda import plan -from conda_env.cli.common import check_specs, get_index_trap +from conda_env.cli.common import check_specs from conda.exceptions import LockError, CondaSystemExit, CondaRuntimeError +from conda.api import get_index from conda.compat import text_type @@ -13,9 +14,9 @@ def install(prefix, specs, args, env, prune=False): # TODO: support all various ways this happens # Including 'nodefaults' in the channels list disables the defaults - index = get_index_trap(channel_urls=[chan for chan in env.channels - if chan != 'nodefaults'], - prepend='nodefaults' not in env.channels) + index = get_index(channel_urls=[chan for chan in env.channels + if chan != 'nodefaults'], + prepend='nodefaults' not in env.channels) actions = plan.install_actions(prefix, index, specs, prune=prune) with common.json_progress_bars(json=args.json and not args.quiet): diff --git a/conda_env/installers/pip.py b/conda_env/installers/pip.py index 705e5b21f17..e4f79018798 100644 --- a/conda_env/installers/pip.py +++ b/conda_env/installers/pip.py @@ -11,4 +11,3 @@ def install(prefix, specs, args, env, prune=False): if process.returncode != 0: raise CondaValueError("pip returned an error.") - diff --git a/tests/conda_env/installers/test_pip.py b/tests/conda_env/installers/test_pip.py index cc231f497ca..aa0764e754c 100644 --- a/tests/conda_env/installers/test_pip.py +++ b/tests/conda_env/installers/test_pip.py @@ -5,7 +5,7 @@ import mock from conda_env.installers import pip - +from conda.exceptions import CondaValueError class PipInstallerTest(unittest.TestCase): def test_straight_install(self): @@ -27,5 +27,5 @@ def test_stops_on_exception(self): # make sure that installed doesn't bail early pip_args.return_value = ['pip'] - self.assertRaises(SystemExit, pip.install, + self.assertRaises(CondaValueError, pip.install, '/some/prefix', ['foo'], '', '') diff --git a/tests/conda_env/support/notebook.ipynb b/tests/conda_env/support/notebook.ipynb index 1b5c38ffc46..b0582df4ccd 100644 --- a/tests/conda_env/support/notebook.ipynb +++ b/tests/conda_env/support/notebook.ipynb @@ -1 +1 @@ -{"nbformat_minor": 0, "worksheets": [{"cells": []}], "nbformat": 3, "metadata": {"signature": "", "name": ""}} \ No newline at end of file +{"nbformat": 3, "nbformat_minor": 0, "worksheets": [{"cells": []}], "metadata": {"name": "", "signature": ""}} \ No newline at end of file diff --git a/tests/conda_env/test_cli.py b/tests/conda_env/test_cli.py index ce42e40c951..13bfb115ecd 100644 --- a/tests/conda_env/test_cli.py +++ b/tests/conda_env/test_cli.py @@ -276,6 +276,8 @@ def test_list(self): run_conda_command(Commands.CREATE, test_env_name_2, "--file " + env_txt.name) self.assertTrue(env_is_created(test_env_name_2)) + snowflake2, e = run_conda_command(Commands.LIST, test_env_name_2, "-e") + self.assertEqual(snowflake, snowflake2) if __name__ == '__main__': unittest.main()