1 #!/usr/bin/env python2.3
4 from StringIO
import StringIO
5 from os
.path
import dirname
, abspath
, join
6 rox_lib
= dirname(dirname(dirname(abspath(sys
.argv
[0]))))
7 sys
.path
.insert(0, join(rox_lib
, 'python'))
9 if os
.environ
.has_key('ROXLIB_TEST_SUB'):
11 for arg
in sys
.argv
[1:]:
14 os
.environ
['ROXLIB_TEST_SUB'] = 'YES'
16 from rox
import processes
18 class TestROX(unittest
.TestCase
):
19 def try_with_args(self
, args
):
21 ptc
= processes
.PipeThroughCommand(
22 ['./testrox.py'] + args
, None, result
)
24 return result
.getvalue()
27 self
.assertEquals('', self
.try_with_args([]))
30 self
.assertEquals('-\n', self
.try_with_args(['-']))
33 self
.assertEquals('hello\nworld\n',
34 self
.try_with_args(['hello', 'world']))
37 self
.assertEquals('world\n-\n',
38 self
.try_with_args(['--g-fatal-warnings',
41 suite
= unittest
.makeSuite(TestROX
)
42 if __name__
== '__main__':