Example #1
0
 def testCanRunConsoleCommand(self):
     scunch.run(['svn', '--version'])
     lines = scunch.run(['svn', '--version'], True)
     self.assertTrue(lines)
     firstLine = lines[0]
     self.assertTrue(firstLine.startswith('svn'), 'first line must start with \'svn\' but is: %r' % firstLine)
     scunch.run(['svn', '--version'], False, os.curdir)
Example #2
0
 def testFailsOnUnknownConsoleCommand(self):
     try:
         scunch.run(['no_such_command'])
         self.fail('broken command must cause ScmError')
     except scunch.ScmError, error:
         actualErrorMessage = str(error)
         expectedErrorMessagePattern = 'cannot perform shell command \'no_such_command\': ?Errno *. Command: no_such_command'
         self.assertTrue(fnmatch.fnmatch(actualErrorMessage, expectedErrorMessagePattern), 'error message must match pattern %r but is: %r' % (expectedErrorMessagePattern, actualErrorMessage))
Example #3
0
 def testRunWithUmlautEchoResult(self):
     scunch._setUpEncoding()
     hello = u'h\xe4ll\xf6'
     helloWithUmlauts = scunch.run([u'echo', hello], returnStdout=True)
     normalizedHelloPy = [unicodedata.normalize(scunch._consoleNormalization, hello)]
     self.assertEqual(helloWithUmlauts, normalizedHelloPy)
Example #4
0
 def testRunWithUmlautEcho(self):
     scunch._setUpEncoding()
     scunch.run([u"echo", u'h\xe4ll\xf6'])
Example #5
0
 def testRunWithAsciiEcho(self):
     scunch._setUpEncoding()
     scunch.run([u"echo", u"hello"])
Example #6
0
 def testFailsOnBrokenConsoleCommand(self):
     try:
         scunch.run(['svn', '--no_such_option'])
         self.fail('broken command must cause ScmError')
     except scunch.ScmError, error:
         self.assertEqual('cannot perform shell command \'svn\'. Error: svn: invalid option: --no_such_option. Command: svn --no_such_option', str(error))