[pypy-commit] pypy default: Add a test for a function in the _demo module.

arigo noreply at buildbot.pypy.org
Sat Feb 18 12:52:42 CET 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r52604:4dcdc1ebfa2c
Date: 2012-02-18 12:52 +0100
http://bitbucket.org/pypy/pypy/changeset/4dcdc1ebfa2c/

Log:	Add a test for a function in the _demo module. Shows the structure
	of app tests.

diff --git a/pypy/module/_demo/test/test_sieve.py b/pypy/module/_demo/test/test_sieve.py
new file mode 100644
--- /dev/null
+++ b/pypy/module/_demo/test/test_sieve.py
@@ -0,0 +1,12 @@
+from pypy.conftest import gettestobjspace
+
+
+class AppTestSieve:
+    def setup_class(cls):
+        cls.space = gettestobjspace(usemodules=('_demo',))
+
+    def test_sieve(self):
+        import _demo
+        lst = _demo.sieve(100)
+        assert lst == [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41,
+                       43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]


More information about the pypy-commit mailing list