Best Python code snippet using autotest_python
__init__.py
Source:__init__.py
...44 from .target_list import create_arch45 if ":" in arch:46 # We have target with options attached47 parts = arch.split(":")48 return create_arch(parts[0], options=tuple(parts[1:]))49 else:50 return create_arch(arch)51 raise ValueError("Invalid architecture {}".format(arch))...
test_create_architecture.py
Source:test_create_architecture.py
1# Copyright 2021 Research Institute of Systems Planning, Inc.2#3# Licensed under the Apache License, Version 2.0 (the "License");4# you may not use this file except in compliance with the License.5# You may obtain a copy of the License at6#7# http://www.apache.org/licenses/LICENSE-2.08#9# Unless required by applicable law or agreed to in writing, software10# distributed under the License is distributed on an "AS IS" BASIS,11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12# See the License for the specific language governing permissions and13# limitations under the License.14from logging import ERROR, INFO15from ros2caret.verb.create_architecture import CreateArchitecture16class TestCreateArchitecture:17 def test_create_success_case(self, caplog, mocker):18 architecture_mock = mocker.Mock()19 mocker.patch.object(architecture_mock, 'export', return_value=None)20 create_arch = CreateArchitecture('', architecture_mock)21 create_arch.create('output_path', True)22 assert len(caplog.records) == 123 record = caplog.records[0]24 assert record.levelno == INFO25 def test_create_fail_case(self, caplog, mocker):26 architecture_mock = mocker.Mock()27 mocker.patch.object(architecture_mock,28 'export',29 side_effect=OSError(''))30 create_arch = CreateArchitecture('', architecture_mock)31 create_arch.create('output_path', True)32 assert len(caplog.records) == 133 record = caplog.records[0]...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!