How to use get_arch method in avocado

Best Python code snippet using avocado_python Github


Full Screen

1import mock2import unittest3class OracleJdkTestCase(unittest.TestCase):4 @mock.patch('fabtools.oracle_jdk.get_arch')5 def test_jdk_arch_for_x64_system(self, get_arch):6 from fabtools.oracle_jdk import _required_jdk_arch7 get_arch.return_value = 'x86_64'8 self.assertEqual('x64', _required_jdk_arch())9 @mock.patch('fabtools.oracle_jdk.get_arch')10 def test_jdk_arch_for_32bit_system(self, get_arch):11 from fabtools.oracle_jdk import _required_jdk_arch12 for system_arch in ['i386', 'i486', 'i586', 'i686']:13 get_arch.return_value = system_arch14 self.assertEqual('i586', _required_jdk_arch())15 @mock.patch('fabtools.oracle_jdk.get_arch')16 def test_jdk_arch_for_unknown_system(self, get_arch):17 from fabtools.oracle_jdk import _required_jdk_arch18 get_arch.return_value = 'unknown'19 self.assertRaises(Exception, _required_jdk_arch)20 def test_jdk_version_with_update_over_ten(self):21 from fabtools.oracle_jdk import _extract_jdk_version22 java_version_out = '''java version "1.7.0_13"23Java(TM) SE Runtime Environment (build 1.7.0_13-b20)24Java HotSpot(TM) Client VM (build 23.7-b01, mixed mode)25'''26 self.assertEqual('7u13-b20', _extract_jdk_version(java_version_out))27 def test_jdk_version_with_update_under_ten(self):28 from fabtools.oracle_jdk import _extract_jdk_version29 java_version_out = '''java version "1.7.0_09"30Java(TM) SE Runtime Environment (build 1.7.0_09-b05)31Java HotSpot(TM) 64-Bit Server VM (build 23.5-b02, mixed mode)32'''33 self.assertEqual('7u9-b05', _extract_jdk_version(java_version_out))34 def test_jdk_version_with_openjdk(self):35 from fabtools.oracle_jdk import _extract_jdk_version36 java_version_out = '''java version "1.7.0_21"37OpenJDK Runtime Environment (IcedTea 2.3.9) (7u21-2.3.9-0ubuntu0.12.04.1)38OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)39'''...

Full Screen

Full Screen Github


Full Screen

...20 """ Try to get the architecture for the current platform """21 if sys.platform.startswith("win"):22 machine = platform.machine()23 if machine == "AMD64":24 return get_arch("x86_64:wincc")25 elif sys.platform == "linux":26 if platform.architecture()[0] == "64bit":27 return get_arch("x86_64")28def get_arch(arch):29 """ Try to return an architecture instance.30 Args:31 arch: can be a string in the form of arch:option1:option232 .. doctest::33 >>> from ppci.api import get_arch34 >>> arch = get_arch('msp430')35 >>> arch36 msp430-arch37 >>> type(arch)38 <class 'ppci.arch.msp430.arch.Msp430Arch'>39 """40 if isinstance(arch, Architecture):41 return arch42 elif isinstance(arch, str):43 # Horrific import cycle created. TODO: restructure this44 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:]))...

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:


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

Run avocado 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?