mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	 04f357cffe
			
		
	
	
		04f357cffe
		
	
	
	
	
		
			
			imports e.g. test_support must do so using an absolute package name such as "import test.test_support" or "from test import test_support". This also updates the README in Lib/test, and gets rid of the duplicate data dirctory in Lib/test/data (replaced by Lib/email/test/data). Now Tim and Jack can have at it. :)
		
			
				
	
	
		
			21 lines
		
	
	
	
		
			613 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
	
		
			613 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| # Test to see if openpty works. (But don't worry if it isn't available.)
 | |
| 
 | |
| import os
 | |
| from test.test_support import verbose, TestFailed, TestSkipped
 | |
| 
 | |
| try:
 | |
|     if verbose:
 | |
|         print "Calling os.openpty()"
 | |
|     master, slave = os.openpty()
 | |
|     if verbose:
 | |
|         print "(master, slave) = (%d, %d)"%(master, slave)
 | |
| except AttributeError:
 | |
|     raise TestSkipped, "No openpty() available."
 | |
| 
 | |
| if not os.isatty(master):
 | |
|     raise TestFailed, "Master-end of pty is not a terminal."
 | |
| if not os.isatty(slave):
 | |
|     raise TestFailed, "Slave-end of pty is not a terminal."
 | |
| 
 | |
| os.write(slave, 'Ping!')
 | |
| print os.read(master, 1024)
 |