[pyrepl-checkins] r45472 - pyrepl/trunk/pyrepl/pyrepl/test

fijal at codespeak.net fijal at codespeak.net
Fri Aug 3 13:31:49 CEST 2007


Author: fijal
Date: Fri Aug  3 13:31:47 2007
New Revision: 45472

Added:
   pyrepl/trunk/pyrepl/pyrepl/test/
   pyrepl/trunk/pyrepl/pyrepl/test/test_functional.py   (contents, props changed)
Log:
Add a very simple testing framework. More stuff needed in this direction.


Added: pyrepl/trunk/pyrepl/pyrepl/test/test_functional.py
==============================================================================
--- (empty file)
+++ pyrepl/trunk/pyrepl/pyrepl/test/test_functional.py	Fri Aug  3 13:31:47 2007
@@ -0,0 +1,30 @@
+# some functional tests, to see if this is really working
+
+import py
+import sys
+
+class TestTerminal(object):
+    def _spawn(self, *args, **kwds):
+        try:
+            import pexpect
+        except ImportError, e:
+            py.test.skip(str(e))
+        kwds.setdefault('timeout', 10)
+        child = pexpect.spawn(*args, **kwds)
+        child.logfile = sys.stdout
+        return child
+
+    def spawn(self, argv=[]):
+        # avoid running start.py, cause it might contain
+        # things like readline or rlcompleter(2) included
+        child = self._spawn(sys.executable, ['-S'] + argv)
+        child.sendline('from pyrepl.python_reader import main')
+        child.sendline('main()')
+        return child
+
+    def test_basic(self):
+        child = self.spawn()
+        child.sendline('a = 3')
+        child.sendline('a')
+        child.expect('3')
+        


More information about the pyrepl-checkins mailing list