Пример #1
0
def test_SubdirData_return_value_contract():
    sd = SubdirData(Channel('pkgs/main/linux-64'))
    query_result = sd.query('openssl')
    assert isinstance(query_result, tuple)
    assert all(isinstance(prec, PackageRecord) for prec in query_result)

    query_all_result = sd.query_all('openssl', (Channel('pkgs/main'),), context.subdirs)
    assert isinstance(query_all_result, tuple)
    assert all(isinstance(prec, PackageRecord) for prec in query_all_result)

    iter_records_result = sd.iter_records()
    assert isiterable(iter_records_result)
    assert all(isinstance(prec, PackageRecord) for prec in iter_records_result)

    reload_result = sd.reload()
    assert isinstance(reload_result, SubdirData)
Пример #2
0
def output_file_exists(output_file, channels):
    '''
    Returns whether a given package name exists within a list of conda channels.
    '''
    match_spec = MatchSpec.from_dist_str(os.path.basename(output_file))
    subdir = os.path.dirname(output_file)
    return bool(
        SubdirData.query_all(match_spec, channels=channels, subdirs=[subdir]))
Пример #3
0
def test_SubdirData_return_value_contract():
    sd = SubdirData(Channel('pkgs/main/linux-64'))
    query_result = sd.query('openssl')
    assert isinstance(query_result, tuple)
    assert all(isinstance(prec, PackageRecord) for prec in query_result)

    query_all_result = sd.query_all('openssl', (Channel('pkgs/main'),), context.subdirs)
    assert isinstance(query_all_result, tuple)
    assert all(isinstance(prec, PackageRecord) for prec in query_all_result)

    iter_records_result = sd.iter_records()
    assert isiterable(iter_records_result)
    assert all(isinstance(prec, PackageRecord) for prec in iter_records_result)

    reload_result = sd.reload()
    assert isinstance(reload_result, SubdirData)
Пример #4
0
def subdir_data_noarch():
    return SubdirData('conda-forge/noarch')
Пример #5
0
def subdir_data_arch():
    subdir = PLATFORM_TO_SUBDIR[sys.platform]
    return SubdirData('conda-forge/' + subdir)