Skip to content

Commit

Permalink
fix test case
Browse files Browse the repository at this point in the history
  • Loading branch information
HugoTian committed Aug 15, 2016
1 parent 2a58c56 commit 6661900
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 18 deletions.
10 changes: 0 additions & 10 deletions conda_env/cli/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
9 changes: 5 additions & 4 deletions conda_env/installers/conda.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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):
Expand Down
1 change: 0 additions & 1 deletion conda_env/installers/pip.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ def install(prefix, specs, args, env, prune=False):

if process.returncode != 0:
raise CondaValueError("pip returned an error.")

4 changes: 2 additions & 2 deletions tests/conda_env/installers/test_pip.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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'], '', '')
2 changes: 1 addition & 1 deletion tests/conda_env/support/notebook.ipynb
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"nbformat_minor": 0, "worksheets": [{"cells": []}], "nbformat": 3, "metadata": {"signature": "", "name": ""}}
{"nbformat": 3, "nbformat_minor": 0, "worksheets": [{"cells": []}], "metadata": {"name": "", "signature": ""}}
2 changes: 2 additions & 0 deletions tests/conda_env/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit 6661900

Please sign in to comment.