示例#1
0
    def test_create_advanced_pip(self):
        with make_temp_envs_dir() as envs_dir:
            with env_vars(
                {
                    'CONDA_ENVS_DIRS': envs_dir,
                    'CONDA_DLL_SEARCH_MODIFICATION_ENABLE': 'true',
                },
                    stack_callback=conda_tests_ctxt_mgmt_def_pol):
                env_name = str(uuid4())[:8]
                run_command(Commands.CREATE, env_name,
                            support_file('pip_argh.yml'))
                out_file = join(envs_dir, 'test_env.yaml')

            # make sure that the export reconsiders the presence of pip interop being enabled
            PrefixData._cache_.clear()

            with env_vars({
                    'CONDA_ENVS_DIRS': envs_dir,
            },
                          stack_callback=conda_tests_ctxt_mgmt_def_pol):
                # note: out of scope of pip interop var.  Should be enabling conda pip interop itself.
                run_command(Commands.EXPORT, env_name, out_file)
                with open(out_file) as f:
                    d = yaml_round_trip_load(f)
                assert {'pip': ['argh==0.26.2']} in d['dependencies']
示例#2
0
    def test_create_advanced_pip(self):
        with make_temp_envs_dir() as envs_dir:
            with env_vars({
                'CONDA_ENVS_DIRS': envs_dir,
                'CONDA_PIP_INTEROP_ENABLED': 'true',
            }, reset_context):
                env_name = str(uuid4())[:8]
                prefix = join(envs_dir, env_name)
                python_path = join(prefix, PYTHON_BINARY)

                run_command(Commands.CREATE, env_name,
                            support_file('pip_argh.yml'))
                out_file = join(envs_dir, 'test_env.yaml')

            # make sure that the export reconsiders the presence of pip interop being enabled
            PrefixData._cache_.clear()

            with env_vars({
                'CONDA_ENVS_DIRS': envs_dir,
            }, reset_context):
                # note: out of scope of pip interop var.  Should be enabling conda pip interop itself.
                run_command(Commands.EXPORT, env_name, out_file)
                with open(out_file) as f:
                    d = ruamel_yaml.load(f)
                assert {'pip': ['argh==0.26.2']} in d['dependencies']
示例#3
0
    def test_create_advanced_pip(self):
        with make_temp_envs_dir() as envs_dir:
            with env_vars(
                {
                    'CONDA_ENVS_DIRS': envs_dir,
                    'CONDA_PIP_INTEROP_ENABLED': 'true',
                }, reset_context):
                env_name = str(uuid4())[:8]
                prefix = join(envs_dir, env_name)
                python_path = join(prefix, PYTHON_BINARY)
                run_command(Commands.CREATE, env_name,
                            support_file('pip_argh.yml'))
                out_file = join(envs_dir, 'test_env.yaml')

            # make sure that the export reconsiders the presence of pip interop being enabled
            PrefixData._cache_.clear()

            with env_vars({
                    'CONDA_ENVS_DIRS': envs_dir,
            }, reset_context):
                # note: out of scope of pip interop var.  Should be enabling conda pip interop itself.
                run_command(Commands.EXPORT, env_name, out_file)
                with open(out_file) as f:
                    d = ruamel_yaml.load(f)
                assert {'pip': ['argh==0.26.2']} in d['dependencies']
示例#4
0
    def test_subdirs_env_var(self):
        subdirs = ('linux-highest', 'linux-64', 'noarch')

        def _channel_urls(channels=None):
            for channel in channels or DEFAULT_CHANNELS:
                channel = Channel(channel)
                for subdir in subdirs:
                    yield join_url(channel.base_url, subdir)

        with env_vars(dict({'CONDA_SUBDIRS': ','.join(subdirs)}), stack_callback=conda_tests_ctxt_mgmt_def_pol):
            c = Channel('defaults')
            assert c.urls() == list(_channel_urls())

            c = Channel('conda-forge')
            assert c.urls() == list(_channel_urls(('conda-forge',)))

            channels = ('bioconda', 'conda-forge')
            prioritized = prioritize_channels(channels)
            assert prioritized == OrderedDict((
                ("https://conda.anaconda.org/bioconda/linux-highest", ("bioconda", 0)),
                ("https://conda.anaconda.org/bioconda/linux-64", ("bioconda", 0)),
                ("https://conda.anaconda.org/bioconda/noarch", ("bioconda", 0)),
                ("https://conda.anaconda.org/conda-forge/linux-highest", ("conda-forge", 1)),
                ("https://conda.anaconda.org/conda-forge/linux-64", ("conda-forge", 1)),
                ("https://conda.anaconda.org/conda-forge/noarch", ("conda-forge", 1)),
            ))

            prioritized = prioritize_channels(channels, subdirs=('linux-again', 'noarch'))
            assert prioritized == OrderedDict((
                ("https://conda.anaconda.org/bioconda/linux-again", ("bioconda", 0)),
                ("https://conda.anaconda.org/bioconda/noarch", ("bioconda", 0)),
                ("https://conda.anaconda.org/conda-forge/linux-again", ("conda-forge", 1)),
                ("https://conda.anaconda.org/conda-forge/noarch", ("conda-forge", 1)),
            ))
示例#5
0
    def test_create_advanced_pip(self):
        with make_temp_envs_dir() as envs_dir:
            with env_vars({
                    'CONDA_ENVS_DIRS': envs_dir,
            },
                          stack_callback=conda_tests_ctxt_mgmt_def_pol):
                env_name = str(uuid4())[:8]
                prefix = join(envs_dir, env_name)
                python_path = join(prefix, PYTHON_BINARY)

                run_command(
                    Commands.CREATE, env_name,
                    support_file(join('advanced-pip', 'environment.yml')))
                assert exists(python_path)
                PrefixData._cache_.clear()
                assert package_is_installed(prefix, 'argh', pip=True)
                assert package_is_installed(
                    prefix, 'module-to-install-in-editable-mode', pip=True)
                try:
                    assert package_is_installed(prefix, 'six', pip=True)
                except AssertionError:
                    # six may now be conda-installed because of packaging changes
                    assert package_is_installed(prefix, 'six', pip=False)
                assert package_is_installed(prefix,
                                            'xmltodict=0.10.2',
                                            pip=True)
示例#6
0
    def test_subdirs_env_var(self):
        subdirs = ('linux-highest', 'linux-64', 'noarch')

        def _channel_urls(channels=None):
            for channel in channels or DEFAULT_CHANNELS:
                channel = Channel(channel)
                for subdir in subdirs:
                    yield join_url(channel.base_url, subdir)

        with env_vars(dict({'CONDA_SUBDIRS': ','.join(subdirs)}), stack_callback=conda_tests_ctxt_mgmt_def_pol):
            c = Channel('defaults')
            assert c.urls() == list(_channel_urls())

            c = Channel('conda-forge')
            assert c.urls() == list(_channel_urls(('conda-forge',)))

            channels = ('bioconda', 'conda-forge')
            prioritized = prioritize_channels(channels)
            assert prioritized == OrderedDict((
                ("https://conda.anaconda.org/bioconda/linux-highest", ("bioconda", 0)),
                ("https://conda.anaconda.org/bioconda/linux-64", ("bioconda", 0)),
                ("https://conda.anaconda.org/bioconda/noarch", ("bioconda", 0)),
                ("https://conda.anaconda.org/conda-forge/linux-highest", ("conda-forge", 1)),
                ("https://conda.anaconda.org/conda-forge/linux-64", ("conda-forge", 1)),
                ("https://conda.anaconda.org/conda-forge/noarch", ("conda-forge", 1)),
            ))

            prioritized = prioritize_channels(channels, subdirs=('linux-again', 'noarch'))
            assert prioritized == OrderedDict((
                ("https://conda.anaconda.org/bioconda/linux-again", ("bioconda", 0)),
                ("https://conda.anaconda.org/bioconda/noarch", ("bioconda", 0)),
                ("https://conda.anaconda.org/conda-forge/linux-again", ("conda-forge", 1)),
                ("https://conda.anaconda.org/conda-forge/noarch", ("conda-forge", 1)),
            ))
示例#7
0
    def test_initialize_dev_cmd_exe(self):
        with env_vars({'CONDA_DRY_RUN': 'true', 'CONDA_VERBOSITY': '0'}, reset_context):
            with tempdir() as conda_temp_prefix:
                new_py = abspath(join(conda_temp_prefix, get_python_short_path()))
                mkdir_p(dirname(new_py))
                create_link(abspath(sys.executable), new_py, LinkType.hardlink if on_win else LinkType.softlink)
                with captured() as c:
                    initialize_dev('cmd.exe', dev_env_prefix=conda_temp_prefix, conda_source_root=dirname(CONDA_PACKAGE_ROOT))

        print(c.stdout)
        print(c.stderr, file=sys.stderr)

        if on_win:
            modified_files = (
                'conda.exe',
                'conda-env.exe',
                'conda-script.py',
                'conda-env-script.py',
                'conda.bat',
                '_conda_activate.bat',
                'conda_auto_activate.bat',
                'conda_hook.bat',
                'activate.bat',
                'activate.bat',
                'deactivate.bat',
                'activate',
                'deactivate',
                'conda.sh',
                'conda.fish',
                'conda.xsh',
                'conda.csh',
                'site-packages',  # remove conda in site-packages dir
                'conda.egg-link',
                'easy-install.pth',
                'conda.egg-info',

            )
        else:
            modified_files = (
                'conda',
                'conda-env',
                'activate',
                'deactivate',
                'conda.sh',
                'conda.fish',
                'conda.xsh',
                'conda.csh',
                'site-packages',  # remove conda in site-packages dir
                'conda.egg-link',
                'easy-install.pth',
                'conda.egg-info',

            )

        stderr = c.stderr.replace('no change', 'modified')
        assert stderr.count('modified') == len(modified_files)

        for fn in modified_files:
            line = next(line for line in stderr.splitlines() if line.strip().endswith(fn))
            assert line.strip().startswith('modified'), line
示例#8
0
    def test_install_1(self):
        with env_vars({
                'CONDA_DRY_RUN': 'true',
                'CONDA_VERBOSITY': '0'
        },
                      stack_callback=conda_tests_ctxt_mgmt_def_pol):
            with tempdir() as conda_temp_prefix:
                with captured() as c:
                    install(conda_temp_prefix)

        assert "WARNING: Cannot install xonsh wrapper" in c.stderr
        if on_win:
            modified_files = (
                'conda.exe',
                'conda-env.exe',
                'conda-script.py',
                'conda-env-script.py',
                'conda.bat',  # condabin/conda.bat
                'conda.bat',  # Library/bin/conda.bat
                '_conda_activate.bat',
                'rename_tmp.bat',
                'conda_auto_activate.bat',
                'conda_hook.bat',
                'activate.bat',
                'activate.bat',
                'deactivate.bat',
                'activate',
                'deactivate',
                'conda.sh',
                'conda_bash.sh',
                'conda',  # etc/bash_completion.d/conda
                'conda.fish',
                'Conda.psm1',
                'conda-hook.ps1',
                'conda.csh',
            )
        else:
            modified_files = (
                'conda',  # condabin/conda
                'conda',  # bin/conda
                'conda-env',
                'activate',
                'deactivate',
                'conda.sh',
                'conda_bash.sh',
                'conda',  # etc/bash_completion.d/conda
                'conda.fish',
                'Conda.psm1',
                'conda-hook.ps1',
                'conda.csh',
            )

        print(c.stdout)
        print(c.stderr, file=sys.stderr)

        assert c.stdout.count('modified') == len(modified_files)
        for fn in modified_files:
            line = next(line for line in c.stdout.splitlines()
                        if line.strip().endswith(fn))
            assert line.strip().startswith('modified'), line
示例#9
0
    def test_initialize_dev_cmd_exe(self):
        with env_vars({'CONDA_DRY_RUN': 'true', 'CONDA_VERBOSITY': '0'}, reset_context):
            with tempdir() as conda_temp_prefix:
                new_py = abspath(join(conda_temp_prefix, get_python_short_path()))
                mkdir_p(dirname(new_py))
                create_link(abspath(sys.executable), new_py, LinkType.hardlink if on_win else LinkType.softlink)
                with captured() as c:
                    initialize_dev('cmd.exe', dev_env_prefix=conda_temp_prefix, conda_source_root=dirname(CONDA_PACKAGE_ROOT))

        print(c.stdout)
        print(c.stderr, file=sys.stderr)

        if on_win:
            modified_files = (
                'conda.exe',
                'conda-env.exe',
                'conda-script.py',
                'conda-env-script.py',
                'conda.bat',
                '_conda_activate.bat',
                'conda_auto_activate.bat',
                'conda_hook.bat',
                'activate.bat',
                'activate.bat',
                'deactivate.bat',
                'activate',
                'deactivate',
                'conda.sh',
                'conda.fish',
                'conda.xsh',
                'conda.csh',
                'site-packages',  # remove conda in site-packages dir
                'conda.egg-link',
                'easy-install.pth',
                'conda.egg-info',

            )
        else:
            modified_files = (
                'conda',
                'conda-env',
                'activate',
                'deactivate',
                'conda.sh',
                'conda.fish',
                'conda.xsh',
                'conda.csh',
                'site-packages',  # remove conda in site-packages dir
                'conda.egg-link',
                'easy-install.pth',
                'conda.egg-info',

            )

        stderr = c.stderr.replace('no change', 'modified')
        assert stderr.count('modified') == len(modified_files)

        for fn in modified_files:
            line = next(line for line in stderr.splitlines() if line.strip().endswith(fn))
            assert line.strip().startswith('modified'), line
示例#10
0
def test_supplement_index_with_system_linux(release_str, version):
    index = {}
    with env_vars({'CONDA_OVERRIDE_LINUX': release_str}):
        _supplement_index_with_system(index)

    linux_pkg = next(iter(_ for _ in index if _.name == '__linux'))
    assert linux_pkg.version == version
    assert linux_pkg.package_type == PackageType.VIRTUAL_SYSTEM
示例#11
0
def test_supplement_index_with_system_linux_extended():
    index = {}
    with env_vars({'CONDA_OVERRIDE_LINUX': '4.2.0-42-generic'}):
        _supplement_index_with_system(index)

    linux_pkg = next(iter(_ for _ in index if _.name == '__linux'))
    assert linux_pkg.version == '4.2.0'
    assert linux_pkg.package_type == PackageType.VIRTUAL_SYSTEM
示例#12
0
def test_supplement_index_with_system_osx():
    index = {}
    with env_vars({'CONDA_OVERRIDE_OSX': '0.15'}):
        _supplement_index_with_system(index)

    osx_pkg = next(iter(_ for _ in index if _.name == '__osx'))
    assert osx_pkg.version == '0.15'
    assert osx_pkg.package_type == PackageType.VIRTUAL_SYSTEM
示例#13
0
def test_supplement_index_with_system():
    index = {}
    with env_vars({'CONDA_OVERRIDE_CUDA': '3.2'}):
        _supplement_index_with_system(index)

    cuda_pkg = index['__cuda']
    assert cuda_pkg.version == '3.2'
    assert cuda_pkg.package_type == PackageType.VIRTUAL_SYSTEM
示例#14
0
文件: test_index.py 项目: conda/conda
def test_supplement_index_with_system():
    index = {}
    with env_vars({'CONDA_OVERRIDE_CUDA': '3.2'}):
        _supplement_index_with_system(index)

    cuda_pkg = index['_cuda']
    assert cuda_pkg.version == '3.2'
    assert cuda_pkg.package_type == PackageType.VIRTUAL_SYSTEM
示例#15
0
def test_supplement_index_with_system_glibc():
    index = {}
    with env_vars({'CONDA_OVERRIDE_GLIBC': '2.10'}):
        _supplement_index_with_system(index)

    glibc_pkg = next(iter(_ for _ in index if _.name == '__glibc'))
    assert glibc_pkg.version == '2.10'
    assert glibc_pkg.package_type == PackageType.VIRTUAL_SYSTEM
示例#16
0
def test_supplement_index_with_system_cuda():
    index = {}
    with env_vars({'CONDA_OVERRIDE_CUDA': '3.2'}):
        _supplement_index_with_system(index)

    cuda_pkg = next(iter(_ for _ in index if _.name == '__cuda'))
    assert cuda_pkg.version == '3.2'
    assert cuda_pkg.package_type == PackageType.VIRTUAL_SYSTEM
示例#17
0
 def test_expanded_variables(self):
     with env_vars({'EXPANDED_VAR': 'itsexpanded', 'BOOL_VAR': 'True'}):
         config = SampleConfiguration()._set_raw_data(load_from_string_data('env_vars'))
         assert config.env_var_map['expanded'] == 'itsexpanded'
         assert config.env_var_map['unexpanded'] == '$UNEXPANDED_VAR'
         assert config.env_var_str == 'itsexpanded'
         assert config.env_var_bool is True
         assert config.normal_str == '$EXPANDED_VAR'
         assert config.env_var_list == ('itsexpanded', '$UNEXPANDED_VAR', 'regular_var')
示例#18
0
def test_tar_bz2_in_pkg_cache_doesnt_overwrite_conda_pkg():
    """
    Test that if a .tar.bz2 package is downloaded and extracted in a package cache, the
    complementary .conda package replaces it if that's what is requested.
    """
    with env_vars({'CONDA_SEPARATE_FORMAT_CACHE': True},
                  stack_callback=conda_tests_ctxt_mgmt_def_pol):
        with make_temp_package_cache() as pkgs_dir:
            # Cache the .tar.bz2 file in the package cache and extract it
            pfe = ProgressiveFetchExtract((zlib_tar_bz2_prec, ))
            pfe.prepare()
            assert len(pfe.cache_actions) == 1
            assert len(pfe.extract_actions) == 1
            cache_action = pfe.cache_actions[0]
            extact_action = pfe.extract_actions[0]
            assert basename(cache_action.target_full_path) == zlib_tar_bz2_fn
            assert cache_action.target_full_path == extact_action.source_full_path
            assert basename(extact_action.target_full_path) == zlib_base_fn

            # Go ahead with executing download and extract now
            pfe.execute()

            assert isfile(join(pkgs_dir, zlib_tar_bz2_fn))
            assert isfile(
                join(pkgs_dir, zlib_base_fn, "info", "repodata_record.json"))

            # Ensure second download/extract is a no-op
            pfe = ProgressiveFetchExtract((zlib_tar_bz2_prec, ))
            pfe.prepare()
            assert len(pfe.cache_actions) == 0
            assert len(pfe.extract_actions) == 0

            # Now ensure download/extract for the complementary .conda package replaces the
            # extracted .tar.bz2
            pfe = ProgressiveFetchExtract((zlib_conda_prec, ))
            pfe.prepare()
            assert len(pfe.cache_actions) == 1
            assert len(pfe.extract_actions) == 1
            cache_action = pfe.cache_actions[0]
            extact_action = pfe.extract_actions[0]
            assert basename(cache_action.target_full_path) == zlib_conda_fn
            assert cache_action.target_full_path == extact_action.source_full_path
            assert basename(extact_action.target_full_path) == zlib_base_fn

            pfe.execute()

            with open(
                    join(pkgs_dir, zlib_base_fn, "info",
                         "repodata_record.json")) as fh:
                repodata_record = json.load(fh)
            assert repodata_record["fn"] == zlib_conda_fn

            # Now check urls.txt to make sure extensions are included.
            urls_text = tuple(yield_lines(join(pkgs_dir, "urls.txt")))
            assert urls_text[0] == zlib_tar_bz2_prec.url
            assert urls_text[1] == zlib_conda_prec.url
示例#19
0
 def test_expanded_variables(self):
     with env_vars({'EXPANDED_VAR': 'itsexpanded', 'BOOL_VAR': 'True'}):
         config = SampleConfiguration()._set_raw_data(
             load_from_string_data('env_vars'))
         assert config.env_var_map['expanded'] == 'itsexpanded'
         assert config.env_var_map['unexpanded'] == '$UNEXPANDED_VAR'
         assert config.env_var_str == 'itsexpanded'
         assert config.env_var_bool is True
         assert config.normal_str == '$EXPANDED_VAR'
         assert config.env_var_list == ('itsexpanded', '$UNEXPANDED_VAR',
                                        'regular_var')
示例#20
0
def test_tar_bz2_in_pkg_cache_doesnt_overwrite_conda_pkg():
    """
    Test that if a .tar.bz2 package is downloaded and extracted in a package cache, the
    complementary .conda package replaces it if that's what is requested.
    """
    with env_vars({'CONDA_SEPARATE_FORMAT_CACHE': True},
                  stack_callback=conda_tests_ctxt_mgmt_def_pol):
        with make_temp_package_cache() as pkgs_dir:
            # Cache the .tar.bz2 file in the package cache and extract it
            pfe = ProgressiveFetchExtract((zlib_tar_bz2_prec,))
            pfe.prepare()
            assert len(pfe.cache_actions) == 1
            assert len(pfe.extract_actions) == 1
            cache_action = pfe.cache_actions[0]
            extact_action = pfe.extract_actions[0]
            assert basename(cache_action.target_full_path) == zlib_tar_bz2_fn
            assert cache_action.target_full_path == extact_action.source_full_path
            assert basename(extact_action.target_full_path) == zlib_base_fn

            # Go ahead with executing download and extract now
            pfe.execute()

            assert isfile(join(pkgs_dir, zlib_tar_bz2_fn))
            assert isfile(join(pkgs_dir, zlib_base_fn, "info", "repodata_record.json"))

            # Ensure second download/extract is a no-op
            pfe = ProgressiveFetchExtract((zlib_tar_bz2_prec,))
            pfe.prepare()
            assert len(pfe.cache_actions) == 0
            assert len(pfe.extract_actions) == 0

            # Now ensure download/extract for the complementary .conda package replaces the
            # extracted .tar.bz2
            pfe = ProgressiveFetchExtract((zlib_conda_prec,))
            pfe.prepare()
            assert len(pfe.cache_actions) == 1
            assert len(pfe.extract_actions) == 1
            cache_action = pfe.cache_actions[0]
            extact_action = pfe.extract_actions[0]
            assert basename(cache_action.target_full_path) == zlib_conda_fn
            assert cache_action.target_full_path == extact_action.source_full_path
            assert basename(extact_action.target_full_path) == zlib_base_fn

            pfe.execute()

            with open(join(pkgs_dir, zlib_base_fn, "info", "repodata_record.json")) as fh:
                repodata_record = json.load(fh)
            assert repodata_record["fn"] == zlib_conda_fn

            # Now check urls.txt to make sure extensions are included.
            urls_text = tuple(yield_lines(join(pkgs_dir, "urls.txt")))
            assert urls_text[0] == zlib_tar_bz2_prec.url
            assert urls_text[1] == zlib_conda_prec.url
示例#21
0
文件: test_env.py 项目: conda/conda
    def test_create_advanced_pip(self):
        with make_temp_envs_dir() as envs_dir:
            with env_vars({
                'CONDA_ENVS_DIRS': envs_dir,
                'CONDA_DLL_SEARCH_MODIFICATION_ENABLE': 'true',
            }, stack_callback=conda_tests_ctxt_mgmt_def_pol):
                env_name = str(uuid4())[:8]
                run_command(Commands.CREATE, env_name,
                            support_file('pip_argh.yml'))
                out_file = join(envs_dir, 'test_env.yaml')

            # make sure that the export reconsiders the presence of pip interop being enabled
            PrefixData._cache_.clear()

            with env_vars({
                'CONDA_ENVS_DIRS': envs_dir,
            }, stack_callback=conda_tests_ctxt_mgmt_def_pol):
                # note: out of scope of pip interop var.  Should be enabling conda pip interop itself.
                run_command(Commands.EXPORT, env_name, out_file)
                with open(out_file) as f:
                    d = yaml_load(f)
                assert {'pip': ['argh==0.26.2']} in d['dependencies']
示例#22
0
    def test_install_1(self):
        with env_vars({'CONDA_DRY_RUN': 'true', 'CONDA_VERBOSITY': '0'}, conda_tests_ctxt_mgmt_def_pol):
            with tempdir() as conda_temp_prefix:
                with captured() as c:
                    install(conda_temp_prefix)

        assert "WARNING: Cannot install xonsh wrapper" in c.stderr
        if on_win:
            modified_files = (
                'conda.exe',
                'conda-env.exe',
                'conda-script.py',
                'conda-env-script.py',
                'conda.bat',  # condabin/conda.bat
                'conda.bat',  # Library/bin/conda.bat
                '_conda_activate.bat',
                'rename_tmp.bat',
                'conda_auto_activate.bat',
                'conda_hook.bat',
                'activate.bat',
                'activate.bat',
                'deactivate.bat',
                'activate',
                'deactivate',
                'conda.sh',
                'conda.fish',
                'Conda.psm1',
                'conda-hook.ps1',
                'conda.csh',
            )
        else:
            modified_files = (
                'conda',  # condabin/conda
                'conda',  # bin/conda
                'conda-env',
                'activate',
                'deactivate',
                'conda.sh',
                'conda.fish',
                'Conda.psm1',
                'conda-hook.ps1',
                'conda.csh',
            )

        print(c.stdout)
        print(c.stderr, file=sys.stderr)

        assert c.stdout.count('modified') == len(modified_files)
        for fn in modified_files:
            line = next(line for line in c.stdout.splitlines() if line.strip().endswith(fn))
            assert line.strip().startswith('modified'), line
示例#23
0
    def test_threads(self):
        default_value = None
        assert context.default_threads == default_value
        assert context.repodata_threads == default_value
        assert context.verify_threads == 1
        assert context.execute_threads == 1

        with env_var('CONDA_DEFAULT_THREADS',
                     '3',
                     stack_callback=conda_tests_ctxt_mgmt_def_pol):
            assert context.default_threads == 3
            assert context.verify_threads == 3
            assert context.repodata_threads == 3
            assert context.execute_threads == 3

        with env_var('CONDA_VERIFY_THREADS',
                     '3',
                     stack_callback=conda_tests_ctxt_mgmt_def_pol):
            assert context.default_threads == default_value
            assert context.verify_threads == 3
            assert context.repodata_threads == default_value
            assert context.execute_threads == 1

        with env_var('CONDA_REPODATA_THREADS',
                     '3',
                     stack_callback=conda_tests_ctxt_mgmt_def_pol):
            assert context.default_threads == default_value
            assert context.verify_threads == 1
            assert context.repodata_threads == 3
            assert context.execute_threads == 1

        with env_var('CONDA_EXECUTE_THREADS',
                     '3',
                     stack_callback=conda_tests_ctxt_mgmt_def_pol):
            assert context.default_threads == default_value
            assert context.verify_threads == 1
            assert context.repodata_threads == default_value
            assert context.execute_threads == 3

        with env_vars(
            {
                'CONDA_EXECUTE_THREADS': '3',
                'CONDA_DEFAULT_THREADS': '1'
            },
                stack_callback=conda_tests_ctxt_mgmt_def_pol):

            assert context.default_threads == 1
            assert context.verify_threads == 1
            assert context.repodata_threads == 1
            assert context.execute_threads == 3
示例#24
0
    def test_install_1(self):
        with env_vars({
                'CONDA_DRY_RUN': 'true',
                'CONDA_VERBOSITY': '0'
        }, reset_context):
            with tempdir() as conda_temp_prefix:
                with captured() as c:
                    install(conda_temp_prefix)

        assert "WARNING: Cannot install xonsh wrapper" in c.stderr
        if on_win:
            modified_files = (
                'conda.exe',
                'conda-env.exe',
                'conda-script.py',
                'conda-env-script.py',
                'conda.bat',
                '_conda_activate.bat',
                'conda_auto_activate.bat',
                'conda_hook.bat',
                'activate.bat',
                'activate.bat',
                'deactivate.bat',
                'activate',
                'deactivate',
                'conda.sh',
                'conda.fish',
                'conda.csh',
            )
        else:
            modified_files = (
                'conda',  # condabin/conda
                'conda',  # bin/conda
                'conda-env',
                'activate',
                'deactivate',
                'conda.sh',
                'conda.fish',
                'conda.csh',
            )

        print(c.stdout)
        print(c.stderr, file=sys.stderr)

        assert c.stdout.count('modified') == len(modified_files)
        for fn in modified_files:
            line = next(line for line in c.stdout.splitlines()
                        if line.strip().endswith(fn))
            assert line.strip().startswith('modified'), line
示例#25
0
文件: test_index.py 项目: noahp/conda
def test_check_whitelist():
    whitelist = ('defaults', 'conda-forge',
                 'https://beta.conda.anaconda.org/conda-test')
    with env_vars({'CONDA_WHITELIST_CHANNELS': ','.join(whitelist)},
                  stack_callback=conda_tests_ctxt_mgmt_def_pol):
        with pytest.raises(ChannelNotAllowed):
            get_index(("conda-canary", ))

        with pytest.raises(ChannelNotAllowed):
            get_index(("https://repo.anaconda.com/pkgs/denied", ))

        check_whitelist(("defaults", ))
        check_whitelist((DEFAULT_CHANNELS[0], DEFAULT_CHANNELS[1]))
        check_whitelist(("https://conda.anaconda.org/conda-forge/linux-64", ))

    check_whitelist(("conda-canary", ))
示例#26
0
文件: test_index.py 项目: conda/conda
def test_check_whitelist():
    whitelist = (
        'defaults',
        'conda-forge',
        'https://beta.conda.anaconda.org/conda-test'
    )
    with env_vars({'CONDA_WHITELIST_CHANNELS': ','.join(whitelist)}, stack_callback=conda_tests_ctxt_mgmt_def_pol):
        with pytest.raises(ChannelNotAllowed):
            get_index(("conda-canary",))

        with pytest.raises(ChannelNotAllowed):
            get_index(("https://repo.anaconda.com/pkgs/denied",))

        check_whitelist(("defaults",))
        check_whitelist((DEFAULT_CHANNELS[0], DEFAULT_CHANNELS[1]))
        check_whitelist(("https://conda.anaconda.org/conda-forge/linux-64",))

    check_whitelist(("conda-canary",))
示例#27
0
    def test_create_advanced_pip(self):
        with make_temp_envs_dir() as envs_dir:
            with env_vars({
                'CONDA_ENVS_DIRS': envs_dir,
            }, stack_callback=conda_tests_ctxt_mgmt_def_pol):
                env_name = str(uuid4())[:8]
                prefix = join(envs_dir, env_name)
                python_path = join(prefix, PYTHON_BINARY)

                run_command(Commands.CREATE, env_name,
                            support_file(join('advanced-pip', 'environment.yml')))
                assert exists(python_path)
                PrefixData._cache_.clear()
                assert package_is_installed(prefix, 'argh', pip=True)
                assert package_is_installed(prefix, 'module-to-install-in-editable-mode', pip=True)
                try:
                    assert package_is_installed(prefix, 'six', pip=True)
                except AssertionError:
                    # six may now be conda-installed because of packaging changes
                    assert package_is_installed(prefix, 'six', pip=False)
                assert package_is_installed(prefix, 'xmltodict=0.10.2', pip=True)
示例#28
0
from conda.exports import subdir
from conda.common.io import env_vars
from conda.cli import python_api

pkgs_dir = os.path.join(sys.prefix, 'pkgs')

channel_map = {
    'free': 'https://repo.anaconda.com/pkgs/free',
    'main': 'https://repo.anaconda.com/pkgs/main',
    'r': 'https://repo.anaconda.com/pkgs/r',
    'conda-forge': 'https://conda.anaconda.org/conda-forge',
    'bioconda': 'https://conda.anaconda.org/bioconda',
}

with env_vars({
        "CONDA_PKGS_DIRS": os.path.join('repos', 'main', subdir),
}):
    try:
        python_api.run_command("create", "-n", "fakeenv", "--download-only",
                               "python", "mkl")
    except:
        pass
    if sys.platform != "win32":
        try:
            python_api.run_command("create", "-n", "fakeenv",
                                   "--download-only", "libopenblas")
        except:
            pass

for chan, url in channel_map.items():
    for _subdir in (subdir, 'noarch'):
示例#29
0
    def test_posix_basic(self):
        activator = Activator('posix')
        self.make_dot_d_files(activator.script_extension)

        with captured() as c:
            rc = activate_main(('', 'shell.posix', 'activate', self.prefix))
        assert not c.stderr
        assert rc == 0
        activate_data = c.stdout

        new_path_parts = activator._add_prefix_to_path(self.prefix)
        assert activate_data == dals("""
        PS1='%(ps1)s'
        export CONDA_DEFAULT_ENV='%(native_prefix)s'
        export CONDA_PREFIX='%(native_prefix)s'
        export CONDA_PROMPT_MODIFIER='(%(native_prefix)s) '
        export CONDA_PYTHON_EXE='%(sys_executable)s'
        export CONDA_SHLVL='1'
        export PATH='%(new_path)s'
        . "%(activate1)s"
        """) % {
            'converted_prefix': activator.path_conversion(self.prefix),
            'native_prefix': self.prefix,
            'new_path': activator.pathsep_join(new_path_parts),
            'sys_executable': activator.path_conversion(sys.executable),
            'activate1': activator.path_conversion(join(self.prefix, 'etc', 'conda', 'activate.d', 'activate1.sh')),
            'ps1': '(%s) ' % self.prefix + os.environ.get('PS1', '')
        }

        with env_vars({
            'CONDA_PREFIX': self.prefix,
            'CONDA_SHLVL': '1',
            'PATH': os.pathsep.join(concatv(new_path_parts, (os.environ['PATH'],))),
        }):
            with captured() as c:
                rc = activate_main(('', 'shell.posix', 'reactivate'))
            assert not c.stderr
            assert rc == 0
            reactivate_data = c.stdout

            assert reactivate_data == dals("""
            . "%(deactivate1)s"
            export CONDA_PROMPT_MODIFIER='(%(native_prefix)s) '
            export CONDA_SHLVL='1'
            . "%(activate1)s"
            """) % {
                'activate1': activator.path_conversion(join(self.prefix, 'etc', 'conda', 'activate.d', 'activate1.sh')),
                'deactivate1': activator.path_conversion(join(self.prefix, 'etc', 'conda', 'deactivate.d', 'deactivate1.sh')),
                'native_prefix': self.prefix,
            }

            with captured() as c:
                rc = activate_main(('', 'shell.posix', 'deactivate'))
            assert not c.stderr
            assert rc == 0
            deactivate_data = c.stdout

            new_path = activator.pathsep_join(activator._remove_prefix_from_path(self.prefix))
            assert deactivate_data == dals("""
            . "%(deactivate1)s"
            unset CONDA_DEFAULT_ENV
            unset CONDA_PREFIX
            unset CONDA_PROMPT_MODIFIER
            unset CONDA_PYTHON_EXE
            PS1='%(ps1)s'
            export CONDA_SHLVL='0'
            export PATH='%(new_path)s'
            """) % {
                'new_path': new_path,
                'deactivate1': activator.path_conversion(join(self.prefix, 'etc', 'conda', 'deactivate.d', 'deactivate1.sh')),
                'ps1': os.environ.get('PS1', ''),
            }
示例#30
0
    def test_powershell_basic(self):
        activator = Activator('powershell')
        self.make_dot_d_files(activator.script_extension)

        with captured() as c:
            rc = activate_main(('', 'shell.powershell', 'activate', self.prefix))
        assert not c.stderr
        assert rc == 0
        activate_data = c.stdout

        new_path_parts = activator._add_prefix_to_path(self.prefix)
        assert activate_data == dals("""
        $env:CONDA_DEFAULT_ENV = "%(prefix)s"
        $env:CONDA_PREFIX = "%(prefix)s"
        $env:CONDA_PROMPT_MODIFIER = "(%(prefix)s) "
        $env:CONDA_PYTHON_EXE = "%(sys_executable)s"
        $env:CONDA_SHLVL = "1"
        $env:PATH = "%(new_path)s"
        . "%(activate1)s"
        """) % {
            'prefix': self.prefix,
            'new_path': activator.pathsep_join(new_path_parts),
            'sys_executable': sys.executable,
            'activate1': join(self.prefix, 'etc', 'conda', 'activate.d', 'activate1.ps1')
        }

        with env_vars({
            'CONDA_PREFIX': self.prefix,
            'CONDA_SHLVL': '1',
            'PATH': os.pathsep.join(concatv(new_path_parts, (os.environ['PATH'],))),
        }):
            with captured() as c:
                rc = activate_main(('', 'shell.powershell', 'reactivate'))
            assert not c.stderr
            assert rc == 0
            reactivate_data = c.stdout

            assert reactivate_data == dals("""
            $env:CONDA_PROMPT_MODIFIER = "(%(prefix)s) "
            $env:CONDA_SHLVL = "1"
            . "%(deactivate1)s"
            . "%(activate1)s"
            """) % {
                'activate1': join(self.prefix, 'etc', 'conda', 'activate.d', 'activate1.ps1'),
                'deactivate1': join(self.prefix, 'etc', 'conda', 'deactivate.d', 'deactivate1.ps1'),
                'prefix': self.prefix,
            }

            with captured() as c:
                rc = activate_main(('', 'shell.powershell', 'deactivate'))
            assert not c.stderr
            assert rc == 0
            deactivate_data = c.stdout

            new_path = activator.pathsep_join(activator._remove_prefix_from_path(self.prefix))
            assert deactivate_data == dals("""
            Remove-Variable CONDA_DEFAULT_ENV
            Remove-Variable CONDA_PREFIX
            Remove-Variable CONDA_PROMPT_MODIFIER
            Remove-Variable CONDA_PYTHON_EXE
            $env:CONDA_SHLVL = "0"
            $env:PATH = "%(new_path)s"
            . "%(deactivate1)s"
            """) % {
                'new_path': new_path,
                'deactivate1': join(self.prefix, 'etc', 'conda', 'deactivate.d', 'deactivate1.ps1'),

            }
示例#31
0
    def test_fish_basic(self):
        activator = Activator('fish')
        self.make_dot_d_files(activator.script_extension)

        with captured() as c:
            rc = activate_main(('', 'shell.fish', 'activate', self.prefix))
        assert not c.stderr
        assert rc == 0
        activate_data = c.stdout

        new_path_parts = activator._add_prefix_to_path(self.prefix)
        assert activate_data == dals("""
        set -gx CONDA_DEFAULT_ENV "%(native_prefix)s"
        set -gx CONDA_PREFIX "%(native_prefix)s"
        set -gx CONDA_PROMPT_MODIFIER "(%(native_prefix)s) "
        set -gx CONDA_PYTHON_EXE "%(sys_executable)s"
        set -gx CONDA_SHLVL "1"
        set -gx PATH "%(new_path)s"
        source "%(activate1)s"
        """) % {
            'converted_prefix': activator.path_conversion(self.prefix),
            'native_prefix': self.prefix,
            'new_path': activator.pathsep_join(new_path_parts),
            'sys_executable': activator.path_conversion(sys.executable),
            'activate1': activator.path_conversion(join(self.prefix, 'etc', 'conda', 'activate.d', 'activate1.fish')),
        }

        with env_vars({
            'CONDA_PREFIX': self.prefix,
            'CONDA_SHLVL': '1',
            'PATH': os.pathsep.join(concatv(new_path_parts, (os.environ['PATH'],))),
        }):
            with captured() as c:
                rc = activate_main(('', 'shell.fish', 'reactivate'))
            assert not c.stderr
            assert rc == 0
            reactivate_data = c.stdout

            assert reactivate_data == dals("""
            set -gx CONDA_PROMPT_MODIFIER "(%(native_prefix)s) "
            set -gx CONDA_SHLVL "1"
            source "%(deactivate1)s"
            source "%(activate1)s"
            """) % {
                'activate1': activator.path_conversion(join(self.prefix, 'etc', 'conda', 'activate.d', 'activate1.fish')),
                'deactivate1': activator.path_conversion(join(self.prefix, 'etc', 'conda', 'deactivate.d', 'deactivate1.fish')),
                'native_prefix': self.prefix,
            }

            with captured() as c:
                rc = activate_main(('', 'shell.fish', 'deactivate'))
            assert not c.stderr
            assert rc == 0
            deactivate_data = c.stdout

            new_path = activator.pathsep_join(activator._remove_prefix_from_path(self.prefix))
            assert deactivate_data == dals("""
            set -e CONDA_DEFAULT_ENV
            set -e CONDA_PREFIX
            set -e CONDA_PROMPT_MODIFIER
            set -e CONDA_PYTHON_EXE
            set -gx CONDA_SHLVL "0"
            set -gx PATH "%(new_path)s"
            source "%(deactivate1)s"
            """) % {
                'new_path': new_path,
                'deactivate1': activator.path_conversion(join(self.prefix, 'etc', 'conda', 'deactivate.d', 'deactivate1.fish')),

            }
示例#32
0
    def test_xonsh_basic(self):
        activator = Activator('xonsh')
        self.make_dot_d_files(activator.script_extension)

        with captured() as c:
            rc = activate_main(('', 'shell.xonsh', 'activate', self.prefix))
        assert not c.stderr
        assert rc == 0
        activate_result = c.stdout

        with open(activate_result) as fh:
            activate_data = fh.read()
        rm_rf(activate_result)

        new_path_parts = activator._add_prefix_to_path(self.prefix)
        assert activate_data == dals("""
        $CONDA_DEFAULT_ENV = "%(native_prefix)s"
        $CONDA_PREFIX = "%(native_prefix)s"
        $CONDA_PROMPT_MODIFIER = "(%(native_prefix)s) "
        $CONDA_PYTHON_EXE = "%(sys_executable)s"
        $CONDA_SHLVL = "1"
        $PATH = "%(new_path)s"
        source "%(activate1)s"
        """) % {
            'converted_prefix': activator.path_conversion(self.prefix),
            'native_prefix': self.prefix,
            'new_path': activator.pathsep_join(new_path_parts),
            'sys_executable': activator.path_conversion(sys.executable),
            'activate1': activator.path_conversion(join(self.prefix, 'etc', 'conda', 'activate.d', 'activate1.xsh')),
        }

        with env_vars({
            'CONDA_PREFIX': self.prefix,
            'CONDA_SHLVL': '1',
            'PATH': os.pathsep.join(concatv(new_path_parts, (os.environ['PATH'],))),
        }):
            with captured() as c:
                assert activate_main(('', 'shell.xonsh', 'reactivate')) == 0
            assert not c.stderr
            reactivate_result = c.stdout

            with open(reactivate_result) as fh:
                reactivate_data = fh.read()
            rm_rf(reactivate_result)

            assert reactivate_data == dals("""
            $CONDA_PROMPT_MODIFIER = "(%(native_prefix)s) "
            $CONDA_SHLVL = "1"
            source "%(deactivate1)s"
            source "%(activate1)s"
            """) % {
                'activate1': activator.path_conversion(join(self.prefix, 'etc', 'conda', 'activate.d', 'activate1.xsh')),
                'deactivate1': activator.path_conversion(join(self.prefix, 'etc', 'conda', 'deactivate.d', 'deactivate1.xsh')),
                'native_prefix': self.prefix,
            }

            with captured() as c:
                assert activate_main(('', 'shell.xonsh', 'deactivate')) == 0
            assert not c.stderr
            deactivate_result = c.stdout

            with open(deactivate_result) as fh:
                deactivate_data = fh.read()
            rm_rf(deactivate_result)

            new_path = activator.pathsep_join(activator._remove_prefix_from_path(self.prefix))
            assert deactivate_data == dals("""
            del $CONDA_DEFAULT_ENV
            del $CONDA_PREFIX
            del $CONDA_PROMPT_MODIFIER
            del $CONDA_PYTHON_EXE
            $CONDA_SHLVL = "0"
            $PATH = "%(new_path)s"
            source "%(deactivate1)s"
            """) % {
                'new_path': new_path,
                'deactivate1': activator.path_conversion(join(self.prefix, 'etc', 'conda', 'deactivate.d', 'deactivate1.xsh')),
            }
示例#33
0
    def test_cmd_exe_basic(self):
        activator = Activator('cmd.exe')
        self.make_dot_d_files(activator.script_extension)

        with captured() as c:
            rc = activate_main(('', 'shell.cmd.exe', 'activate', '', self.prefix))
        assert not c.stderr
        assert rc == 0
        activate_result = c.stdout

        with open(activate_result) as fh:
            activate_data = fh.read()
        rm_rf(activate_result)

        new_path_parts = activator._add_prefix_to_path(self.prefix)
        assert activate_data == dals("""
        @SET "CONDA_DEFAULT_ENV=%(native_prefix)s"
        @SET "CONDA_PREFIX=%(converted_prefix)s"
        @SET "CONDA_PROMPT_MODIFIER=(%(native_prefix)s) "
        @SET "CONDA_PYTHON_EXE=%(sys_executable)s"
        @SET "CONDA_SHLVL=1"
        @SET "PATH=%(new_path)s"
        @SET "PYTHONIOENCODING=%(PYTHONIOENCODING)s"
        @CALL "%(activate1)s"
        """) % {
            'converted_prefix': activator.path_conversion(self.prefix),
            'native_prefix': self.prefix,
            'new_path': activator.pathsep_join(new_path_parts),
            'sys_executable': activator.path_conversion(sys.executable),
            'activate1': activator.path_conversion(join(self.prefix, 'etc', 'conda', 'activate.d', 'activate1.bat')),
            'PYTHONIOENCODING': PYTHONIOENCODING,
        }

        with env_vars({
            'CONDA_PREFIX': self.prefix,
            'CONDA_SHLVL': '1',
            'PATH': os.pathsep.join(concatv(new_path_parts, (os.environ['PATH'],))),
        }):
            with captured() as c:
                assert activate_main(('', 'shell.cmd.exe', 'reactivate')) == 0
            assert not c.stderr
            reactivate_result = c.stdout

            with open(reactivate_result) as fh:
                reactivate_data = fh.read()
            rm_rf(reactivate_result)

            assert reactivate_data == dals("""
            @CALL "%(deactivate1)s"
            @SET "CONDA_PROMPT_MODIFIER=(%(native_prefix)s) "
            @SET "CONDA_SHLVL=1"
            @CALL "%(activate1)s"
            """) % {
                'activate1': activator.path_conversion(join(self.prefix, 'etc', 'conda', 'activate.d', 'activate1.bat')),
                'deactivate1': activator.path_conversion(join(self.prefix, 'etc', 'conda', 'deactivate.d', 'deactivate1.bat')),
                'native_prefix': self.prefix,
            }

            with captured() as c:
                assert activate_main(('', 'shell.cmd.exe', 'deactivate')) == 0
            assert not c.stderr
            deactivate_result = c.stdout

            with open(deactivate_result) as fh:
                deactivate_data = fh.read()
            rm_rf(deactivate_result)

            new_path = activator.pathsep_join(activator._remove_prefix_from_path(self.prefix))
            assert deactivate_data == dals("""
            @CALL "%(deactivate1)s"
            @SET CONDA_DEFAULT_ENV=
            @SET CONDA_PREFIX=
            @SET CONDA_PROMPT_MODIFIER=
            @SET CONDA_PYTHON_EXE=
            @SET "CONDA_SHLVL=0"
            @SET "PATH=%(new_path)s"
            """) % {
                'new_path': new_path,
                'deactivate1': activator.path_conversion(join(self.prefix, 'etc', 'conda', 'deactivate.d', 'deactivate1.bat')),
            }
示例#34
0
    def test_initialize_dev_bash(self):
        with pytest.raises(CondaValueError):
            initialize_dev('bash', conda_source_root=join('a', 'b', 'c'))

        with env_vars({'CONDA_DRY_RUN': 'true', 'CONDA_VERBOSITY': '0'}, conda_tests_ctxt_mgmt_def_pol):
            with tempdir() as conda_temp_prefix:
                new_py = abspath(join(conda_temp_prefix, get_python_short_path()))
                mkdir_p(dirname(new_py))
                create_link(abspath(sys.executable), new_py, LinkType.hardlink if on_win else LinkType.softlink)
                with captured() as c:
                    initialize_dev('bash', dev_env_prefix=conda_temp_prefix, conda_source_root=dirname(CONDA_PACKAGE_ROOT))

        print(c.stdout)
        print(c.stderr, file=sys.stderr)

        if on_win:
            modified_files = (
                'conda.exe',
                'conda-env.exe',
                'conda-script.py',
                'conda-env-script.py',
                'conda.bat',  # condabin/conda.bat
                'conda.bat',  # Library/bin/conda.bat
                '_conda_activate.bat',
                'rename_tmp.bat',
                'conda_auto_activate.bat',
                'conda_hook.bat',
                'activate.bat',
                'activate.bat',
                'deactivate.bat',
                'activate',
                'deactivate',
                'conda.sh',
                'conda.fish',
                'Conda.psm1',
                'conda-hook.ps1',
                'conda.xsh',
                'conda.csh',
                'site-packages',  # remove conda in site-packages dir
                'conda.egg-link',
                'easy-install.pth',
                'conda.egg-info',
            )
        else:
            modified_files = (
                'conda',  # condabin/conda
                'conda',  # bin/conda
                'conda-env',
                'activate',
                'deactivate',
                'conda.sh',
                'conda.fish',
                'Conda.psm1',
                'conda-hook.ps1',
                'conda.xsh',
                'conda.csh',
                'site-packages',  # remove conda in site-packages dir
                'conda.egg-link',
                'easy-install.pth',
                'conda.egg-info',
            )

        stderr = c.stderr.replace('no change', 'modified')
        assert stderr.count('modified') == len(modified_files)

        for fn in modified_files:
            line = next(line for line in stderr.splitlines() if line.strip().endswith(fn))
            assert line.strip().startswith('modified'), line

        assert "unset CONDA_SHLVL" in c.stdout
    def test_initialize_dev_bash(self):
        with pytest.raises(CondaValueError):
            initialize_dev('bash', conda_source_root=join('a', 'b', 'c'))

        with env_vars({'CONDA_DRY_RUN': 'true', 'CONDA_VERBOSITY': '0'}, stack_callback=conda_tests_ctxt_mgmt_def_pol):
            with tempdir() as conda_temp_prefix:
                new_py = abspath(join(conda_temp_prefix, get_python_short_path()))
                mkdir_p(dirname(new_py))
                create_link(abspath(sys.executable), new_py, LinkType.hardlink if on_win else LinkType.softlink)
                with captured() as c:
                    initialize_dev('bash', dev_env_prefix=conda_temp_prefix, conda_source_root=dirname(CONDA_PACKAGE_ROOT))

        print(c.stdout)
        print(c.stderr, file=sys.stderr)

        if on_win:
            modified_files = (
                'conda.exe',
                'conda-env.exe',
                'conda-script.py',
                'conda-env-script.py',
                'conda.bat',  # condabin/conda.bat
                'conda.bat',  # Library/bin/conda.bat
                '_conda_activate.bat',
                'rename_tmp.bat',
                'conda_auto_activate.bat',
                'conda_hook.bat',
                'activate.bat',
                'activate.bat',
                'deactivate.bat',
                'activate',
                'deactivate',
                'conda.sh',
                'conda.fish',
                'Conda.psm1',
                'conda-hook.ps1',
                'conda.xsh',
                'conda.csh',
                'site-packages',  # remove conda in site-packages dir
                'conda.egg-link',
                'easy-install.pth',
                'conda.egg-info',
            )
        else:
            modified_files = (
                'conda',  # condabin/conda
                'conda',  # bin/conda
                'conda-env',
                'activate',
                'deactivate',
                'conda.sh',
                'conda.fish',
                'Conda.psm1',
                'conda-hook.ps1',
                'conda.xsh',
                'conda.csh',
                'site-packages',  # remove conda in site-packages dir
                'conda.egg-link',
                'easy-install.pth',
                'conda.egg-info',
            )

        stderr = c.stderr.replace('no change', 'modified')
        assert stderr.count('modified') == len(modified_files)

        for fn in modified_files:
            line = next(line for line in stderr.splitlines() if line.strip().endswith(fn))
            assert line.strip().startswith('modified'), line

        assert "unset CONDA_SHLVL" in c.stdout