[pypy-svn] r16465 - pypy/dist/pypy/doc
cfbolz at codespeak.net
cfbolz at codespeak.net
Thu Aug 25 12:57:18 CEST 2005
Author: cfbolz
Date: Thu Aug 25 12:57:17 2005
New Revision: 16465
Modified:
pypy/dist/pypy/doc/coding-guide.txt
Log:
add description of the new feature to pass in values into AppTests
Modified: pypy/dist/pypy/doc/coding-guide.txt
==============================================================================
--- pypy/dist/pypy/doc/coding-guide.txt (original)
+++ pypy/dist/pypy/doc/coding-guide.txt Thu Aug 25 12:57:17 2005
@@ -891,6 +891,22 @@
runs at application level. If you need to use modules
you have to import them within the test function.
+Another possibility to pass in data into the AppTest is to use
+the ``setup_class`` method of the AppTest. All wrapped objects that are
+attached to the class there and start with ``w_`` can be accessed
+via self (but without the ``w_``) in the actual test method. An example::
+
+ from pypy.objspace.std import StdObjSpace
+
+ class AppTestErrno:
+ def setup_class(cls):
+ cls.space = StdObjSpace()
+ cls.w_d = cls.space.wrap({"a": 1, "b", 2})
+
+ def test_dict(self):
+ assert self.d["a"] == 1
+ assert self.d["b"] == 2
+
.. _`run the tests as usual`:
Command line tool test_all
More information about the Pypy-commit
mailing list