summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornoah <noah@656d521f-e311-0410-88e0-e7920216d269>2003-02-25 09:33:18 +0000
committernoah <noah@656d521f-e311-0410-88e0-e7920216d269>2003-02-25 09:33:18 +0000
commit0d33dc595a34944cb713406950663235a65d92d6 (patch)
treed6743971612c87637f608326ccc26730fda698e1
parent66311e2d604ac62d8d931a843de85035378dd76d (diff)
downloadpexpect-0d33dc595a34944cb713406950663235a65d92d6.tar.gz
This tests if the new facility to use expect with already open file descriptors.
You pass the spawn constructor a file descriptor and then it will use that instead of opening one from a pty. git-svn-id: http://pexpect.svn.sourceforge.net/svnroot/pexpect/trunk@152 656d521f-e311-0410-88e0-e7920216d269
-rw-r--r--pexpect/setup.py21
-rwxr-xr-xpexpect/tests/test_filedescriptor.py28
2 files changed, 28 insertions, 21 deletions
diff --git a/pexpect/setup.py b/pexpect/setup.py
index cb7592f..ce8e33c 100644
--- a/pexpect/setup.py
+++ b/pexpect/setup.py
@@ -12,27 +12,6 @@ setup (name='pexpect',
url='http://pexpect.sourceforge.net/',
license='Python Software Foundation License',
platforms='UNIX',
- classifiers = [
- 'Development Status :: 4 - Beta',
- 'Environment :: Console',
- 'Environment :: Console (Text Based)',
- 'Intended Audience :: Developers',
- 'Intended Audience :: System Administrators',
- 'Intended Audience :: Quality Engineers',
- 'License :: OSI Approved :: Python Software Foundation License',
- 'Operating System :: POSIX',
- 'Operating System :: MacOS :: MacOS X',
- 'Programming Language :: Python',
- 'Topic :: Software Development',
- 'Topic :: Software Development :: Libraries :: Python Modules',
- 'Topic :: Software Development :: Quality Assurance',
- 'Topic :: Software Development :: Testing',
- 'Topic :: System, System :: Archiving :: Packaging, System :: Installation/Setup',
- 'Topic :: System :: Shells',
- 'Topic :: System :: Software Distribution',
- 'Topic :: Terminals, Utilities',
- ],
-
)
# classifiers = [
diff --git a/pexpect/tests/test_filedescriptor.py b/pexpect/tests/test_filedescriptor.py
new file mode 100755
index 0000000..594bfe3
--- /dev/null
+++ b/pexpect/tests/test_filedescriptor.py
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+import pexpect
+import unittest
+import sys
+import os
+
+class ExpectTestCase(unittest.TestCase):
+
+ def test_fd (self):
+
+ fd = os.open ('README.txt', os.O_RDONLY)
+ s = pexpect.spawn (fd)
+ s.expect ('License:')
+ s.expect (pexpect.EOF)
+ assert s.before == ' Python Software Foundation License\n\nNoah Spurrier\nhttp://pexpect.sourceforge.net/\n\n\n'
+
+if __name__ == '__main__':
+ unittest.main()
+
+suite = unittest.makeSuite(ExpectTestCase, 'test')
+
+#fout = open('delete_me_1','wb')
+#fout.write(the_old_way)
+#fout.close
+#fout = open('delete_me_2', 'wb')
+#fout.write(the_new_way)
+#fout.close
+