コード例 #1
0
 def do_test(dirname):
     monkeypatch.setattr(
         'anaconda_project.internal.conda_api._get_conda_command',
         get_command)
     conda_api.info()
     (out, err) = capsys.readouterr()
     assert 'TEST_ERROR' in err
コード例 #2
0
 def do_test(dirname):
     monkeypatch.setattr(
         'anaconda_project.internal.conda_api._get_conda_command',
         get_command)
     with pytest.raises(conda_api.CondaError) as excinfo:
         conda_api.info()
     assert 'Invalid JSON from conda' in repr(excinfo.value)
コード例 #3
0
 def do_test(dirname):
     monkeypatch.setattr(
         'anaconda_project.internal.conda_api._get_conda_command',
         get_failed_command)
     with pytest.raises(conda_api.CondaError) as excinfo:
         conda_api.info()
     assert 'TEST_ERROR' in repr(excinfo.value)
コード例 #4
0
 def do_test(dirname):
     monkeypatch.setattr('subprocess.Popen', mock_popen)
     with pytest.raises(conda_api.CondaError) as excinfo:
         conda_api.info()
     assert 'failed to exec' in repr(excinfo.value)
     conda_cmd = os.path.basename(conda_api.CONDA_EXE)
     assert conda_cmd + ' info' in repr(excinfo.value)
コード例 #5
0
def test_conda_info():
    json = conda_api.info()

    print(repr(json))  # pytest shows this on failure
    assert isinstance(json, dict)

    # check that some stuff is in here.
    # conda apparently doesn't guarantee that any of this is here,
    # but if it changes I guess we'd like to know via test failure.
    assert 'channels' in json
    assert 'root_prefix' in json
    assert 'platform' in json
    assert 'envs' in json
コード例 #6
0
def test_msys_for_all_platforms():
    for p in conda_api.default_platforms_plus_32_bit:
        (name, bits) = conda_api.parse_platform(p)
        info = conda_api.info(platform=p)
        print("*** info() for %s" % p)
        pprint(info)
        assert 'channels' in info

        # conda 4.1 has a slash on the channels and 4.3 does not
        def no_slash(url):
            if url.endswith("/"):
                return url[:-1]
            else:
                return url

        channels = [no_slash(channel) for channel in info['channels']]
        if name == 'win':
            assert ('https://repo.continuum.io/pkgs/msys2/%s' % p) in channels
            assert ('https://repo.continuum.io/pkgs/msys2/noarch') in channels
        else:
            for c in channels:
                assert 'msys' not in c
コード例 #7
0
def test_msys_for_all_platforms():
    for p in conda_api.default_platforms_plus_32_bit:
        (name, bits) = conda_api.parse_platform(p)
        info = conda_api.info(platform=p)
        print("*** info() for %s" % p)
        pprint(info)
        assert 'channels' in info

        # conda 4.1 has a slash on the channels and 4.3 does not
        def no_slash(url):
            if url.endswith("/"):
                return url[:-1]
            else:
                return url

        channels = [no_slash(channel) for channel in info['channels']]
        # Designed to handle repo.continuum.io and repo.anaconda.com
        channels = '\n'.join(channels)
        if name == 'win':
            assert '/msys2/%s' % p in channels
            assert '/msys2/noarch' in channels
        else:
            assert '/msys2' not in channels
コード例 #8
0
 def do_test(dirname):
     monkeypatch.setattr('subprocess.Popen', mock_popen)
     with pytest.raises(conda_api.CondaError) as excinfo:
         conda_api.info()
     assert 'failed to exec' in repr(excinfo.value)
     assert 'conda info' in repr(excinfo.value)