コード例 #1
0
ファイル: utils_test.py プロジェクト: chrisalice/gittools
def test_iteration_error_stderr():
  p = Sh('cat', 'DOES-NOT-EXIST')
  try:
    p.next()
    assert False and 'Expected ShError'
  except ShError, e:
    assert 'cat: DOES-NOT-EXIST: No such file or directory\n' == e.stderr
コード例 #2
0
ファイル: utils_test.py プロジェクト: chrisalice/gittools
def test_iteration_error_stdout_no_stderr():
  p = Sh('bash', '-c', 'echo hello ; false')
  assert 'hello' == p.next()
  try:
    p.next()
    assert False and 'Expected ShError'
  except ShError, e:
    pass
コード例 #3
0
ファイル: utils_test.py プロジェクト: chrisalice/gittools
def test_iteration_no_newline_no_error():
  x = Sh('printf', 'hello')
  assert 'hello' == x.next()
  try:
    x.next()
    assert False and 'Expected StopIteration'
  except StopIteration:
    pass
コード例 #4
0
ファイル: utils_test.py プロジェクト: chrisalice/gittools
def test_iteration_error_no_stderr():
  p = Sh('false')
  try:
    p.next()
    assert False and 'Expected ShError'
  except ShError, e:
    assert 1 == e.returncode
    assert ('false',) == e.cmd
    assert '' == e.stderr
コード例 #5
0
ファイル: utils_test.py プロジェクト: chrisalice/gittools
def test_iteration_many_lines_no_error():
  x = Sh('bash', '-c', 'for i in {1..1000}; do echo hello; done')
  for i in xrange(1000):
    assert 'hello' == x.next()
  try:
    x.next()
    assert False and 'Expected StopIteration'
  except StopIteration:
    pass