[pypy-commit] pyrepl py3ksupport: pytest-ize functonal tests

RonnyPfannschmidt noreply at buildbot.pypy.org
Wed Oct 19 10:44:47 CEST 2011


Author: Ronny Pfannschmidt <Ronny.Pfannschmidt at gmx.de>
Branch: py3ksupport
Changeset: r134:828ecb76b616
Date: 2011-10-18 12:24 +0200
http://bitbucket.org/pypy/pyrepl/changeset/828ecb76b616/

Log:	pytest-ize functonal tests

diff --git a/testing/test_functional.py b/testing/test_functional.py
--- a/testing/test_functional.py
+++ b/testing/test_functional.py
@@ -20,31 +20,19 @@
 
 # some functional tests, to see if this is really working
 
-import py
+import pytest
 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 pytest_funcarg__child(request):
+    pexpect = pytest.importorskip('pexpect')
+    child = pexpect.spawn(sys.executable, ['-S'], timeout=10)
+    child.logfile = sys.stdout
+    child.sendline('from pyrepl.python_reader import main')
+    child.sendline('main()')
+    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(child):
+    child.sendline('a = 3')
+    child.sendline('a')
+    child.expect('3')
 
-    def test_basic(self):
-        child = self.spawn()
-        child.sendline('a = 3')
-        child.sendline('a')
-        child.expect('3')
-


More information about the pypy-commit mailing list