How to use _create_loader method in localstack

Best Python code snippet using localstack_python

__init__.py

Source:__init__.py Github

copy

Full Screen

...54 port = None55 yield "port", port56data_server = GoslingDataServer()57CreateTileset = Callable[[pathlib.Path], tilesets.Tileset]58def _create_loader(type_: str, create_ts: Optional[CreateTileset] = None):59 def load(url: Union[pathlib.Path, str], **kwargs):60 """Adds resource to data_server if local file is detected."""61 fp = pathlib.Path(url)62 if fp.is_file():63 data = create_ts(fp) if create_ts else fp64 url = data_server(data)65 # bam's index file url66 if "indexUrl" in kwargs:67 fp = pathlib.Path(kwargs["indexUrl"])68 if fp.is_file():69 kwargs["indexUrl"] = data_server(fp)70 return dict(type=type_, url=str(url), **kwargs)71 return load72# in-memory data73def json(values: List[Dict[str, Any]], **kwargs):74 return dict(type="json", values=values, **kwargs)75# file resources76bam = _create_loader("bam")77csv = _create_loader("csv")78bigwig = _create_loader("bigwig")79# tileset resources80beddb = _create_loader("beddb", tilesets.beddb)81vector = _create_loader("vector", tilesets.bigwig)82matrix = _create_loader("matrix", tilesets.cooler)...

Full Screen

Full Screen

test_configuration_loader.py

Source:test_configuration_loader.py Github

copy

Full Screen

...11def _create_test_config(tmpdir):12 config_file = tmpdir.join("config.yaml")13 config_file.write(FILE_CONTENT)14 return config_file15def _create_loader(tmpdir):16 config_file = _create_test_config(tmpdir)17 return ConfigurationLoader(config_file)18def test_get_section_missing(tmpdir):19 """20 Checks if the appropriate error is raised if section is not present.21 """22 cfg = _create_loader(tmpdir)23 with pytest.raises(KeyError):24 cfg.get_section('missing section')25def test_get_section_valid_section(tmpdir):26 """27 Checks if sections are read correctly.28 """29 cfg = _create_loader(tmpdir)30 assert cfg.get_section('section1') == {'key1': 'value1', 'key2': 'value2'}31 assert not cfg.get_section('section2')32def test_get_entry_missing_section(tmpdir):33 """34 Checks if the appropriate error is raised if section is missing.35 """36 cfg = _create_loader(tmpdir)37 with pytest.raises(KeyError):38 cfg.get_entry('missing section', 'value')39def test_get_entry_missing_key(tmpdir):40 """41 Checks if the appropriate error is raised if entry key is missing.42 """43 cfg = _create_loader(tmpdir)44 with pytest.raises(KeyError):45 cfg.get_entry('section2', 'missing key')46def test_get_entry_valid_section(tmpdir):47 """48 Checks if a valid entry gets read correctly.49 """50 cfg = _create_loader(tmpdir)51 assert cfg.get_section('section1') == {'key1': 'value1', 'key2': 'value2'}52 assert not cfg.get_section('section2')53def test_reload_config(tmpdir):54 """55 Checks if config gets reloaded correctly.56 """57 config_path = _create_test_config(tmpdir)58 cfg = ConfigurationLoader(config_path)59 assert cfg.get_entry('section1', 'key1') == 'value1'60 new_content = FILE_CONTENT.replace('value1', 'modified value1')61 config_path.write(new_content)62 cfg.reload_config()...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful