def testSplittedExecution(self): """Verify the mechanism that avoids too long command lines""" args = [str(i) * 20 for i in range(10)] if platform != 'win32': c = ExternalCommand(['echo']) else: c = ExternalCommand(['cmd','/c','echo']) c.MAX_CMDLINE_LENGTH = 30 out = c.execute(args, stdout=PIPE)[0] self.assertEqual(out.read(), '\n'.join([args[i]+' '+args[i+1] for i in range(0,10,2)])+'\n') c = ExternalCommand(['echo']) c.MAX_CMDLINE_LENGTH = None out = c.execute(args, stdout=PIPE)[0] self.assertEqual(out.read(), ' '.join(args)+'\n')
def testSplittedExecution(self): """Verify the mechanism that avoids too long command lines""" args = [str(i) * 20 for i in range(10)] if platform != 'win32': c = ExternalCommand(['echo']) else: c = ExternalCommand(['cmd', '/c', 'echo']) c.MAX_CMDLINE_LENGTH = 30 out = c.execute(args, stdout=PIPE)[0] self.assertEqual( out.read(), '\n'.join([args[i] + ' ' + args[i + 1] for i in range(0, 10, 2)]) + '\n') c = ExternalCommand(['echo']) c.MAX_CMDLINE_LENGTH = None out = c.execute(args, stdout=PIPE)[0] self.assertEqual(out.read(), ' '.join(args) + '\n')