def test_close(intake_server): catalog = Catalog(intake_server) d = catalog.entry1.get() d.close()
def test_empty_catalog(): cat = Catalog() assert list(cat) == []
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']
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()
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)
def invoke(self, args): catalog = Catalog(args.uri) with catalog[args.name].get() as f: print(f.discover())
def test_entry_metadata(intake_server): catalog = Catalog(intake_server) entry = catalog['arr'] assert entry.metadata == entry().metadata
def test_access_subcatalog(intake_server): catalog = Catalog(intake_server) catalog['nested']
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)
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)
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()
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
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
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)
def exists(args): catalog = Catalog(args.uri) print(args.name in catalog)
def test_parser_validation_error(filename): with pytest.raises(exceptions.ValidationError): Catalog(abspath(filename + ".yml"))
def get(args): catalog = Catalog(args.uri) with catalog[args.name].get() as f: print(f.read())
def catalog1(): path = os.path.dirname(__file__) return Catalog(os.path.join(path, 'catalog1.yml'))
def discover(args): catalog = Catalog(args.uri) with catalog[args.name].get() as f: print(f.discover())
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)
def invoke(self, args): catalog = Catalog(args.uri) print_entry_info(catalog, args.name)