~vil/pydev/upstream

« back to all changes in this revision

Viewing changes to org.python.pydev.debug/pysrc/tests/test_pydevdio.py

  • Committer: Vladimír Lapáček
  • Date: 2006-08-30 18:38:44 UTC
  • Revision ID: vladimir.lapacek@gmail.com-20060830183844-f4d82c1239a7770a
Initial import of upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import sys
 
2
import os
 
3
 
 
4
#make it as if we were executing from the directory above this one (so that we can use jycompletionserver
 
5
#without the need for it being in the pythonpath)
 
6
sys.argv[0] = os.path.dirname(sys.argv[0]) 
 
7
#twice the dirname to get the previous level from this file.
 
8
sys.path.insert(1, os.path.join(  os.path.dirname( sys.argv[0] )) )
 
9
 
 
10
import unittest
 
11
 
 
12
class Test(unittest.TestCase):
 
13
    
 
14
    def testIt(self):
 
15
        import pydevd_io
 
16
        original = sys.stdout
 
17
        
 
18
        try:
 
19
            sys.stdout = pydevd_io.IOBuf()
 
20
            print 'foo'
 
21
            print 'bar'
 
22
            
 
23
            self.assertEquals('foo\nbar\n', sys.stdout.getvalue()) #@UndefinedVariable
 
24
            
 
25
            print 'ww'
 
26
            print 'xx'
 
27
            self.assertEquals('ww\nxx\n', sys.stdout.getvalue()) #@UndefinedVariable
 
28
        finally:
 
29
            sys.stdout = original
 
30
        
 
31
if __name__ == '__main__':
 
32
    unittest.main()