Skip to content

Commit

Permalink
add conda clean --index-cache test
Browse files Browse the repository at this point in the history
  • Loading branch information
kalefranz committed Oct 20, 2016
1 parent 5fa57f3 commit 2b440cb
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions tests/test_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,23 @@
from conda.base.context import context, reset_context
from conda.cli.common import get_index_trap
from conda.cli.main import generate_parser
from conda.cli.main_clean import configure_parser as clean_configure_parser
from conda.cli.main_config import configure_parser as config_configure_parser
from conda.cli.main_create import configure_parser as create_configure_parser
from conda.cli.main_info import configure_parser as info_configure_parser
from conda.cli.main_install import configure_parser as install_configure_parser
from conda.cli.main_list import configure_parser as list_configure_parser
from conda.cli.main_remove import configure_parser as remove_configure_parser
from conda.cli.main_search import configure_parser as search_configure_parser
from conda.cli.main_update import configure_parser as update_configure_parser
from conda.common.io import captured, disable_logger, stderr_log_level, replace_log_streams
from conda.common.io import captured, disable_logger, replace_log_streams, stderr_log_level
from conda.common.url import path_to_url
from conda.common.yaml import yaml_load
from conda.compat import itervalues
from conda.connection import LocalFSAdapter
from conda.exceptions import DryRunExit, conda_exception_handler, CondaHTTPError
from conda.install import dist2dirname, linked as install_linked, linked_data, linked_data_, on_win
from conda.exceptions import CondaHTTPError, DryRunExit, conda_exception_handler
from conda.install import dist2dirname, linked as install_linked, linked_data, linked_data_
from conda.utils import on_win
from contextlib import contextmanager
from datetime import datetime
from glob import glob
Expand Down Expand Up @@ -63,7 +66,9 @@ def make_temp_prefix(name=None, create_directory=True):

class Commands:
CONFIG = "config"
CLEAN = "clean"
CREATE = "create"
INFO = "info"
INSTALL = "install"
LIST = "list"
REMOVE = "remove"
Expand All @@ -73,7 +78,9 @@ class Commands:

parser_config = {
Commands.CONFIG: config_configure_parser,
Commands.CLEAN: clean_configure_parser,
Commands.CREATE: create_configure_parser,
Commands.INFO: info_configure_parser,
Commands.INSTALL: install_configure_parser,
Commands.LIST: list_configure_parser,
Commands.REMOVE: remove_configure_parser,
Expand Down Expand Up @@ -779,3 +786,16 @@ def test_anaconda_token_with_private_package(self):

finally:
rmtree(prefix, ignore_errors=True)

def test_clean_index_cache(self):
prefix = ''

# make sure we have something in the index cache
stdout, stderr = run_command(Commands.INFO, prefix, "flask --json")
assert "flask" in json_loads(stdout)
index_cache_dir = create_cache_dir()
assert glob(join(index_cache_dir, "*.json"))

# now clear it
run_command(Commands.CLEAN, prefix, "--index-cache")
assert not glob(join(index_cache_dir, "*.json"))

0 comments on commit 2b440cb

Please sign in to comment.