MCPcopy Create free account
hub / github.com/dtmilano/AndroidViewClient / main

Method main

src/com/dtmilano/android/viewclient.py:4976–5010  ·  view source on GitHub ↗
(*args, **kwargs)

Source from the content-addressed store, hash-verified

4974
4975 @staticmethod
4976 def main(*args, **kwargs):
4977 # If you want to specify tests classes and methods in the command line you will be forced
4978 # to include -s or --serialno and the serial number of the device (could be a regexp)
4979 # as ViewClient would have no way of determine what it is.
4980 # This could be also a list of devices (delimited by whitespaces) and in such case all of
4981 # them will be used.
4982 # The special argument 'all' means all the connected devices.
4983 ser = ['-s', '--serialno']
4984 old = '%(failfast)'
4985 new = ' %s s The serial number[s] to connect to or \'all\'\n%s' % (', '.join(ser), old)
4986 try:
4987 unittest.TestProgram.USAGE = unittest.TestProgram.USAGE.replace(old, new)
4988 except AttributeError as ex:
4989 if DEBUG:
4990 print(ex, file=sys.stderr)
4991 argsToRemove = []
4992 i = 0
4993 while i < len(sys.argv):
4994 a = sys.argv[i]
4995 if a in ['-v', '--verbose']:
4996 # make CulebraTestCase.verbose the same as unittest verbose
4997 CulebraTestCase.verbose = True
4998 elif a in ser:
4999 # remove arguments not handled by unittest
5000 if len(sys.argv) > (i + 1):
5001 argsToRemove.append(sys.argv[i])
5002 CulebraTestCase.serialno = sys.argv[i + 1]
5003 argsToRemove.append(CulebraTestCase.serialno)
5004 i += 1
5005 else:
5006 raise RuntimeError('serial number missing')
5007 i += 1
5008 for a in argsToRemove:
5009 sys.argv.remove(a)
5010 unittest.main(*args, **kwargs)
5011
5012
5013if __name__ == "__main__":

Calls 2

appendMethod · 0.80
removeMethod · 0.45

Tested by

no test coverage detected