def test_close(intake_server):
    catalog = Catalog(intake_server)

    d = catalog.entry1.get()
    d.close()
Example #2
0
def test_empty_catalog():
    cat = Catalog()
    assert list(cat) == []
Example #3
0
 def get_app(self):
     local_catalog = Catalog(catalog_file)
     self.server = IntakeServer(local_catalog)
     return self.server.make_app()
def test_environment_evaluation(intake_server):
    catalog = Catalog(intake_server)
    import os
    os.environ['INTAKE_TEST'] = 'client'
    catalog['remote_env']
Example #5
0
def test_parser_obsolete_error(filename):
    with pytest.raises(exceptions.ObsoleteError):
        Catalog(abspath(filename + ".yml"))
def test_bad_url(intake_server):
    bad_url = intake_server + '/nonsense_prefix'

    with pytest.raises(Exception):
        Catalog(bad_url)
def test_unknown_source(intake_server):
    catalog = Catalog(intake_server)

    with pytest.raises(Exception):
        catalog['does_not_exist'].describe()
Example #8
0
def test_len(intake_server):
    remote_catalog = Catalog(intake_server)
    local_catalog = Catalog(TEST_CATALOG_PATH)
    assert sum(1 for entry in local_catalog) == len(remote_catalog)
Example #9
0
 def invoke(self, args):
     catalog = Catalog(args.uri)
     with catalog[args.name].get() as f:
         print(f.discover())
Example #10
0
def test_entry_metadata(intake_server):
    catalog = Catalog(intake_server)
    entry = catalog['arr']
    assert entry.metadata == entry().metadata
Example #11
0
def test_access_subcatalog(intake_server):
    catalog = Catalog(intake_server)
    catalog['nested']
Example #12
0
def test_duplicate_data_sources():
    path = os.path.dirname(__file__)
    uri = os.path.join(path, 'catalog_dup_sources.yml')

    with pytest.raises(exceptions.DuplicateKeyError) as except_info:
        c = Catalog(uri)
Example #13
0
def test_secret_auth_fail(intake_server_with_auth):
    auth = SecretClientAuth(secret='test_wrong_secret')
    with pytest.raises(Exception):
        Catalog(intake_server_with_auth, auth=auth)
Example #14
0
 def invoke(self, args):
     catalog = Catalog(args.uri)
     print(args.name in catalog)
def test_with(intake_server):
    catalog = Catalog(intake_server)

    with catalog.entry1.get() as f:
        assert f.discover()
Example #16
0
 def get_app(self):
     catalog_file = os.path.join(os.path.dirname(__file__), 'catalog1.yml')
     local_catalog = Catalog(catalog_file)
     self.server = IntakeServer(local_catalog)
     return self.server.make_app()
def test_to_dask(intake_server):
    catalog = Catalog(intake_server)
    d = catalog.entry1.get()
    df = d.to_dask()

    assert df.npartitions == 2
Example #18
0
def test_remote_cat(http_server):
    url = http_server + 'catalog1.yml'
    cat = Catalog(url)
    assert 'entry1' in cat
    assert cat.entry1.describe()
def test_metadata(intake_server):
    catalog = Catalog(intake_server)
    assert hasattr(catalog, 'metadata')
    assert catalog.metadata['test'] is True
    assert catalog.version == 1
Example #20
0
def describe(args):
    catalog = Catalog(args.uri)
    print_entry_info(catalog, args.name)
def test_remote_datasource_interface(intake_server):
    catalog = Catalog(intake_server)

    d = catalog['entry1'].get()

    verify_datasource_interface(d)
Example #22
0
def exists(args):
    catalog = Catalog(args.uri)
    print(args.name in catalog)
Example #23
0
def test_parser_validation_error(filename):
    with pytest.raises(exceptions.ValidationError):
        Catalog(abspath(filename + ".yml"))
Example #24
0
def get(args):
    catalog = Catalog(args.uri)
    with catalog[args.name].get() as f:
        print(f.read())
Example #25
0
def catalog1():
    path = os.path.dirname(__file__)
    return Catalog(os.path.join(path, 'catalog1.yml'))
Example #26
0
def discover(args):
    catalog = Catalog(args.uri)
    with catalog[args.name].get() as f:
        print(f.discover())
Example #27
0
def test_duplicate_parameters():
    path = os.path.dirname(__file__)
    uri = os.path.join(path, 'catalog_dup_parameters.yml')

    with pytest.raises(exceptions.DuplicateKeyError):
        Catalog(uri)
Example #28
0
 def invoke(self, args):
     catalog = Catalog(args.uri)
     print_entry_info(catalog, args.name)