[pypy-svn] r54820 - pypy/dist/pypy/rlib/rsdl/test

arigo at codespeak.net arigo at codespeak.net
Sat May 17 13:23:15 CEST 2008


Author: arigo
Date: Sat May 17 13:23:15 2008
New Revision: 54820

Modified:
   pypy/dist/pypy/rlib/rsdl/test/test_basic.py
Log:
Reorganize tests so that "py.test --view" is needed to
run the tests that try to open a window.


Modified: pypy/dist/pypy/rlib/rsdl/test/test_basic.py
==============================================================================
--- pypy/dist/pypy/rlib/rsdl/test/test_basic.py	(original)
+++ pypy/dist/pypy/rlib/rsdl/test/test_basic.py	Sat May 17 13:23:15 2008
@@ -2,18 +2,13 @@
 from pypy.rlib.rsdl import RSDL
 from pypy.rlib.rarithmetic import r_uint
 from pypy.rpython.lltypesystem import rffi
+from pypy import conftest
 
 
 def test_sdl_init():
     assert RSDL.Init(RSDL.INIT_VIDEO) >= 0
     RSDL.Quit()
 
-def test_set_video_mode():
-    assert RSDL.Init(RSDL.INIT_VIDEO) >= 0
-    surface = RSDL.SetVideoMode(640, 480, 32, 0)
-    assert surface
-    RSDL.Quit()
-
 def test_surface_basic():
     assert RSDL.Init(RSDL.INIT_VIDEO) >= 0
     surface = RSDL.CreateRGBSurface(0, 150, 50, 32,
@@ -26,3 +21,20 @@
     assert rffi.getintfield(surface, 'c_h') == 50
     RSDL.FreeSurface(surface)
     RSDL.Quit()
+
+
+class TestVideo:
+
+    def setup_method(self, meth):
+        if not conftest.option.view:
+            py.test.skip("'--view' not specified, "
+                         "skipping tests that open a window")
+        assert RSDL.Init(RSDL.INIT_VIDEO) >= 0
+        self.surface = RSDL.SetVideoMode(640, 480, 32, 0)
+        assert self.surface
+
+    def test_simple(self):
+        pass   # only checks that opening and closing the window works
+
+    def teardown_method(self, meth):
+        RSDL.Quit()



More information about the Pypy-commit mailing list