From fijal at codespeak.net Fri Aug 3 13:31:49 2007 From: fijal at codespeak.net (fijal at codespeak.net) Date: Fri, 3 Aug 2007 13:31:49 +0200 (CEST) Subject: [pyrepl-checkins] r45472 - pyrepl/trunk/pyrepl/pyrepl/test Message-ID: <20070803113149.A5FB58105@code0.codespeak.net> 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') +