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

Blogs

Check out the latest blogs from LambdaTest on this topic:

13 Best Java Testing Frameworks For 2023

The fact is not alien to us anymore that cross browser testing is imperative to enhance your application’s user experience. Enhanced knowledge of popular and highly acclaimed testing frameworks goes a long way in developing a new app. It holds more significance if you are a full-stack developer or expert programmer.

QA Innovation – Using the senseshaping concept to discover customer needs

QA Innovation - Using the senseshaping concept to discover customer needsQA testers have a unique role and responsibility to serve the customer. Serving the customer in software testing means protecting customers from application defects, failures, and perceived failures from missing or misunderstood requirements. Testing for known requirements based on documentation or discussion is the core of the testing profession. One unique way QA testers can both differentiate themselves and be innovative occurs when senseshaping is used to improve the application user experience.

Best 23 Web Design Trends To Follow In 2023

Having a good web design can empower business and make your brand stand out. According to a survey by Top Design Firms, 50% of users believe that website design is crucial to an organization’s overall brand. Therefore, businesses should prioritize website design to meet customer expectations and build their brand identity. Your website is the face of your business, so it’s important that it’s updated regularly as per the current web design trends.

Acquiring Employee Support for Change Management Implementation

Enterprise resource planning (ERP) is a form of business process management software—typically a suite of integrated applications—that assists a company in managing its operations, interpreting data, and automating various back-office processes. The introduction of a new ERP system is analogous to the introduction of a new product into the market. If the product is not handled appropriately, it will fail, resulting in significant losses for the business. Most significantly, the employees’ time, effort, and morale would suffer as a result of the procedure.

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