How to use get_platform method in AutoItDriverServer

Best Python code snippet using AutoItDriverServer_python

test_sysconfig.py

Source:test_sysconfig.py Github

copy

Full Screen

...90 def test_get_config_vars(self):91 cvars = get_config_vars()92 self.assertIsInstance(cvars, dict)93 self.assertTrue(cvars)94 def test_get_platform(self):95 # windows XP, 32bits96 os.name = 'nt'97 sys.version = ('2.4.4 (#71, Oct 18 2006, 08:34:43) '98 '[MSC v.1310 32 bit (Intel)]')99 sys.platform = 'win32'100 self.assertEqual(get_platform(), 'win32')101 # windows XP, amd64102 os.name = 'nt'103 sys.version = ('2.4.4 (#71, Oct 18 2006, 08:34:43) '104 '[MSC v.1310 32 bit (Amd64)]')105 sys.platform = 'win32'106 self.assertEqual(get_platform(), 'win-amd64')107 # windows XP, itanium108 os.name = 'nt'109 sys.version = ('2.4.4 (#71, Oct 18 2006, 08:34:43) '110 '[MSC v.1310 32 bit (Itanium)]')111 sys.platform = 'win32'112 self.assertEqual(get_platform(), 'win-ia64')113 # macbook114 os.name = 'posix'115 sys.version = ('2.5 (r25:51918, Sep 19 2006, 08:49:13) '116 '\n[GCC 4.0.1 (Apple Computer, Inc. build 5341)]')117 sys.platform = 'darwin'118 self._set_uname(('Darwin', 'macziade', '8.11.1',119 ('Darwin Kernel Version 8.11.1: '120 'Wed Oct 10 18:23:28 PDT 2007; '121 'root:xnu-792.25.20~1/RELEASE_I386'), 'PowerPC'))122 _osx_support._remove_original_values(get_config_vars())123 get_config_vars()['MACOSX_DEPLOYMENT_TARGET'] = '10.3'124 get_config_vars()['CFLAGS'] = ('-fno-strict-aliasing -DNDEBUG -g '125 '-fwrapv -O3 -Wall -Wstrict-prototypes')126 maxint = sys.maxint127 try:128 sys.maxint = 2147483647129 self.assertEqual(get_platform(), 'macosx-10.3-ppc')130 sys.maxint = 9223372036854775807131 self.assertEqual(get_platform(), 'macosx-10.3-ppc64')132 finally:133 sys.maxint = maxint134 self._set_uname(('Darwin', 'macziade', '8.11.1',135 ('Darwin Kernel Version 8.11.1: '136 'Wed Oct 10 18:23:28 PDT 2007; '137 'root:xnu-792.25.20~1/RELEASE_I386'), 'i386'))138 _osx_support._remove_original_values(get_config_vars())139 get_config_vars()['MACOSX_DEPLOYMENT_TARGET'] = '10.3'140 get_config_vars()['CFLAGS'] = ('-fno-strict-aliasing -DNDEBUG -g '141 '-fwrapv -O3 -Wall -Wstrict-prototypes')142 maxint = sys.maxint143 try:144 sys.maxint = 2147483647145 self.assertEqual(get_platform(), 'macosx-10.3-i386')146 sys.maxint = 9223372036854775807147 self.assertEqual(get_platform(), 'macosx-10.3-x86_64')148 finally:149 sys.maxint = maxint150 # macbook with fat binaries (fat, universal or fat64)151 _osx_support._remove_original_values(get_config_vars())152 get_config_vars()['MACOSX_DEPLOYMENT_TARGET'] = '10.4'153 get_config_vars()['CFLAGS'] = ('-arch ppc -arch i386 -isysroot '154 '/Developer/SDKs/MacOSX10.4u.sdk '155 '-fno-strict-aliasing -fno-common '156 '-dynamic -DNDEBUG -g -O3')157 self.assertEqual(get_platform(), 'macosx-10.4-fat')158 _osx_support._remove_original_values(get_config_vars())159 get_config_vars()['CFLAGS'] = ('-arch x86_64 -arch i386 -isysroot '160 '/Developer/SDKs/MacOSX10.4u.sdk '161 '-fno-strict-aliasing -fno-common '162 '-dynamic -DNDEBUG -g -O3')163 self.assertEqual(get_platform(), 'macosx-10.4-intel')164 _osx_support._remove_original_values(get_config_vars())165 get_config_vars()['CFLAGS'] = ('-arch x86_64 -arch ppc -arch i386 -isysroot '166 '/Developer/SDKs/MacOSX10.4u.sdk '167 '-fno-strict-aliasing -fno-common '168 '-dynamic -DNDEBUG -g -O3')169 self.assertEqual(get_platform(), 'macosx-10.4-fat3')170 _osx_support._remove_original_values(get_config_vars())171 get_config_vars()['CFLAGS'] = ('-arch ppc64 -arch x86_64 -arch ppc -arch i386 -isysroot '172 '/Developer/SDKs/MacOSX10.4u.sdk '173 '-fno-strict-aliasing -fno-common '174 '-dynamic -DNDEBUG -g -O3')175 self.assertEqual(get_platform(), 'macosx-10.4-universal')176 _osx_support._remove_original_values(get_config_vars())177 get_config_vars()['CFLAGS'] = ('-arch x86_64 -arch ppc64 -isysroot '178 '/Developer/SDKs/MacOSX10.4u.sdk '179 '-fno-strict-aliasing -fno-common '180 '-dynamic -DNDEBUG -g -O3')181 self.assertEqual(get_platform(), 'macosx-10.4-fat64')182 for arch in ('ppc', 'i386', 'x86_64', 'ppc64'):183 _osx_support._remove_original_values(get_config_vars())184 get_config_vars()['CFLAGS'] = ('-arch %s -isysroot '185 '/Developer/SDKs/MacOSX10.4u.sdk '186 '-fno-strict-aliasing -fno-common '187 '-dynamic -DNDEBUG -g -O3'%(arch,))188 self.assertEqual(get_platform(), 'macosx-10.4-%s'%(arch,))189 # linux debian sarge190 os.name = 'posix'191 sys.version = ('2.3.5 (#1, Jul 4 2007, 17:28:59) '192 '\n[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)]')193 sys.platform = 'linux2'194 self._set_uname(('Linux', 'aglae', '2.6.21.1dedibox-r7',195 '#1 Mon Apr 30 17:25:38 CEST 2007', 'i686'))196 self.assertEqual(get_platform(), 'linux-i686')197 # XXX more platforms to tests here198 def test_get_config_h_filename(self):199 config_h = sysconfig.get_config_h_filename()200 self.assertTrue(os.path.isfile(config_h), config_h)201 def test_get_scheme_names(self):202 wanted = ('nt', 'nt_user', 'os2', 'os2_home', 'osx_framework_user',203 'posix_home', 'posix_prefix', 'posix_user')204 self.assertEqual(get_scheme_names(), wanted)205 @unittest.skipIf(sys.platform.startswith('win'),206 'Test is not Windows compatible')207 def test_get_makefile_filename(self):208 makefile = sysconfig.get_makefile_filename()209 self.assertTrue(os.path.isfile(makefile), makefile)210 # Issue 22199211 self.assertEqual(sysconfig._get_makefile_filename(), makefile)212 def test_symlink(self):213 # Issue 7880214 symlink = get_attribute(os, "symlink")215 def get(python):216 cmd = [python, '-c',217 'import sysconfig; print sysconfig.get_platform()']218 p = subprocess.Popen(cmd, stdout=subprocess.PIPE)219 return p.communicate()220 real = os.path.realpath(sys.executable)221 link = os.path.abspath(TESTFN)222 symlink(real, link)223 try:224 self.assertEqual(get(real), get(link))225 finally:226 unlink(link)227 def test_user_similar(self):228 # Issue #8759: make sure the posix scheme for the users229 # is similar to the global posix_prefix one230 base = get_config_var('base')231 user = get_config_var('userbase')232 # the global scheme mirrors the distinction between prefix and233 # exec-prefix but not the user scheme, so we have to adapt the paths234 # before comparing (issue #9100)235 adapt = sys.prefix != sys.exec_prefix236 for name in ('stdlib', 'platstdlib', 'purelib', 'platlib'):237 global_path = get_path(name, 'posix_prefix')238 if adapt:239 global_path = global_path.replace(sys.exec_prefix, sys.prefix)240 base = base.replace(sys.exec_prefix, sys.prefix)241 user_path = get_path(name, 'posix_user')242 self.assertEqual(user_path, global_path.replace(base, user, 1))243 @unittest.skipUnless(sys.platform == "darwin", "test only relevant on MacOSX")244 def test_platform_in_subprocess(self):245 my_platform = sysconfig.get_platform()246 # Test without MACOSX_DEPLOYMENT_TARGET in the environment247 env = os.environ.copy()248 if 'MACOSX_DEPLOYMENT_TARGET' in env:249 del env['MACOSX_DEPLOYMENT_TARGET']250 with open('/dev/null', 'w') as devnull_fp:251 p = subprocess.Popen([252 sys.executable, '-c',253 'import sysconfig; print(sysconfig.get_platform())',254 ],255 stdout=subprocess.PIPE,256 stderr=devnull_fp,257 env=env)258 test_platform = p.communicate()[0].strip()259 test_platform = test_platform.decode('utf-8')260 status = p.wait()261 self.assertEqual(status, 0)262 self.assertEqual(my_platform, test_platform)263 # Test with MACOSX_DEPLOYMENT_TARGET in the environment, and264 # using a value that is unlikely to be the default one.265 env = os.environ.copy()266 env['MACOSX_DEPLOYMENT_TARGET'] = '10.1'267 p = subprocess.Popen([268 sys.executable, '-c',269 'import sysconfig; print(sysconfig.get_platform())',270 ],271 stdout=subprocess.PIPE,272 stderr=open('/dev/null'),273 env=env)274 test_platform = p.communicate()[0].strip()275 test_platform = test_platform.decode('utf-8')276 status = p.wait()277 self.assertEqual(status, 0)278 self.assertEqual(my_platform, test_platform)279def test_main():280 run_unittest(TestSysConfig)281if __name__ == "__main__":...

Full Screen

Full Screen

test_util.py

Source:test_util.py Github

copy

Full Screen

...52 def _set_uname(self, uname):53 self._uname = uname54 def _get_uname(self):55 return self._uname56 def test_get_platform(self):57 # windows XP, 32bits58 os.name = 'nt'59 sys.version = ('2.4.4 (#71, Oct 18 2006, 08:34:43) '60 '[MSC v.1310 32 bit (Intel)]')61 sys.platform = 'win32'62 self.assertEqual(get_platform(), 'win32')63 # windows XP, amd6464 os.name = 'nt'65 sys.version = ('2.4.4 (#71, Oct 18 2006, 08:34:43) '66 '[MSC v.1310 32 bit (Amd64)]')67 sys.platform = 'win32'68 self.assertEqual(get_platform(), 'win-amd64')69 # windows XP, itanium70 os.name = 'nt'71 sys.version = ('2.4.4 (#71, Oct 18 2006, 08:34:43) '72 '[MSC v.1310 32 bit (Itanium)]')73 sys.platform = 'win32'74 self.assertEqual(get_platform(), 'win-ia64')75 # macbook76 os.name = 'posix'77 sys.version = ('2.5 (r25:51918, Sep 19 2006, 08:49:13) '78 '\n[GCC 4.0.1 (Apple Computer, Inc. build 5341)]')79 sys.platform = 'darwin'80 self._set_uname(('Darwin', 'macziade', '8.11.1',81 ('Darwin Kernel Version 8.11.1: '82 'Wed Oct 10 18:23:28 PDT 2007; '83 'root:xnu-792.25.20~1/RELEASE_I386'), 'i386'))84 _osx_support._remove_original_values(get_config_vars())85 get_config_vars()['MACOSX_DEPLOYMENT_TARGET'] = '10.3'86 get_config_vars()['CFLAGS'] = ('-fno-strict-aliasing -DNDEBUG -g '87 '-fwrapv -O3 -Wall -Wstrict-prototypes')88 cursize = sys.maxsize89 sys.maxsize = (2 ** 31)-190 try:91 self.assertEqual(get_platform(), 'macosx-10.3-i386')92 finally:93 sys.maxsize = cursize94 # macbook with fat binaries (fat, universal or fat64)95 _osx_support._remove_original_values(get_config_vars())96 get_config_vars()['MACOSX_DEPLOYMENT_TARGET'] = '10.4'97 get_config_vars()['CFLAGS'] = ('-arch ppc -arch i386 -isysroot '98 '/Developer/SDKs/MacOSX10.4u.sdk '99 '-fno-strict-aliasing -fno-common '100 '-dynamic -DNDEBUG -g -O3')101 self.assertEqual(get_platform(), 'macosx-10.4-fat')102 _osx_support._remove_original_values(get_config_vars())103 os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.1'104 self.assertEqual(get_platform(), 'macosx-10.4-fat')105 _osx_support._remove_original_values(get_config_vars())106 get_config_vars()['CFLAGS'] = ('-arch x86_64 -arch i386 -isysroot '107 '/Developer/SDKs/MacOSX10.4u.sdk '108 '-fno-strict-aliasing -fno-common '109 '-dynamic -DNDEBUG -g -O3')110 self.assertEqual(get_platform(), 'macosx-10.4-intel')111 _osx_support._remove_original_values(get_config_vars())112 get_config_vars()['CFLAGS'] = ('-arch x86_64 -arch ppc -arch i386 -isysroot '113 '/Developer/SDKs/MacOSX10.4u.sdk '114 '-fno-strict-aliasing -fno-common '115 '-dynamic -DNDEBUG -g -O3')116 self.assertEqual(get_platform(), 'macosx-10.4-fat3')117 _osx_support._remove_original_values(get_config_vars())118 get_config_vars()['CFLAGS'] = ('-arch ppc64 -arch x86_64 -arch ppc -arch i386 -isysroot '119 '/Developer/SDKs/MacOSX10.4u.sdk '120 '-fno-strict-aliasing -fno-common '121 '-dynamic -DNDEBUG -g -O3')122 self.assertEqual(get_platform(), 'macosx-10.4-universal')123 _osx_support._remove_original_values(get_config_vars())124 get_config_vars()['CFLAGS'] = ('-arch x86_64 -arch ppc64 -isysroot '125 '/Developer/SDKs/MacOSX10.4u.sdk '126 '-fno-strict-aliasing -fno-common '127 '-dynamic -DNDEBUG -g -O3')128 self.assertEqual(get_platform(), 'macosx-10.4-fat64')129 for arch in ('ppc', 'i386', 'x86_64', 'ppc64'):130 _osx_support._remove_original_values(get_config_vars())131 get_config_vars()['CFLAGS'] = ('-arch %s -isysroot '132 '/Developer/SDKs/MacOSX10.4u.sdk '133 '-fno-strict-aliasing -fno-common '134 '-dynamic -DNDEBUG -g -O3'%(arch,))135 self.assertEqual(get_platform(), 'macosx-10.4-%s'%(arch,))136 # linux debian sarge137 os.name = 'posix'138 sys.version = ('2.3.5 (#1, Jul 4 2007, 17:28:59) '139 '\n[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)]')140 sys.platform = 'linux2'141 self._set_uname(('Linux', 'aglae', '2.6.21.1dedibox-r7',142 '#1 Mon Apr 30 17:25:38 CEST 2007', 'i686'))143 self.assertEqual(get_platform(), 'linux-i686')144 # XXX more platforms to tests here145 def test_convert_path(self):146 # linux/mac147 os.sep = '/'148 def _join(path):149 return '/'.join(path)150 os.path.join = _join151 self.assertEqual(convert_path('/home/to/my/stuff'),152 '/home/to/my/stuff')153 # win154 os.sep = '\\'155 def _join(*path):156 return '\\'.join(path)157 os.path.join = _join158 self.assertRaises(ValueError, convert_path, '/home/to/my/stuff')159 self.assertRaises(ValueError, convert_path, 'home/to/my/stuff/')160 self.assertEqual(convert_path('home/to/my/stuff'),161 'home\\to\\my\\stuff')162 self.assertEqual(convert_path('.'),163 os.curdir)164 def test_change_root(self):165 # linux/mac166 os.name = 'posix'167 def _isabs(path):168 return path[0] == '/'169 os.path.isabs = _isabs170 def _join(*path):171 return '/'.join(path)172 os.path.join = _join173 self.assertEqual(change_root('/root', '/old/its/here'),174 '/root/old/its/here')175 self.assertEqual(change_root('/root', 'its/here'),176 '/root/its/here')177 # windows178 os.name = 'nt'179 def _isabs(path):180 return path.startswith('c:\\')181 os.path.isabs = _isabs182 def _splitdrive(path):183 if path.startswith('c:'):184 return ('', path.replace('c:', ''))185 return ('', path)186 os.path.splitdrive = _splitdrive187 def _join(*path):188 return '\\'.join(path)189 os.path.join = _join190 self.assertEqual(change_root('c:\\root', 'c:\\old\\its\\here'),191 'c:\\root\\old\\its\\here')192 self.assertEqual(change_root('c:\\root', 'its\\here'),193 'c:\\root\\its\\here')194 # BugsBunny os (it's a great os)195 os.name = 'BugsBunny'196 self.assertRaises(DistutilsPlatformError,197 change_root, 'c:\\root', 'its\\here')198 # XXX platforms to be covered: mac199 def test_check_environ(self):200 util._environ_checked = 0201 if 'HOME' in os.environ:202 del os.environ['HOME']203 # posix without HOME204 if os.name == 'posix': # this test won't run on windows205 check_environ()206 import pwd207 self.assertEqual(os.environ['HOME'], pwd.getpwuid(os.getuid())[5])208 else:209 check_environ()210 self.assertEqual(os.environ['PLAT'], get_platform())211 self.assertEqual(util._environ_checked, 1)212 def test_split_quoted(self):213 self.assertEqual(split_quoted('""one"" "two" \'three\' \\four'),214 ['one', 'two', 'three', 'four'])215 def test_strtobool(self):216 yes = ('y', 'Y', 'yes', 'True', 't', 'true', 'True', 'On', 'on', '1')217 no = ('n', 'no', 'f', 'false', 'off', '0', 'Off', 'No', 'N')218 for y in yes:219 self.assertTrue(strtobool(y))220 for n in no:221 self.assertFalse(strtobool(n))222 def test_rfc822_escape(self):223 header = 'I am a\npoor\nlonesome\nheader\n'224 res = rfc822_escape(header)...

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 AutoItDriverServer 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