annotate test/base_test.py @ 3172:d1b367fc08bc tests-returncode

Use a return code of 1 when the tests fail.
author Thomas Kluyver <takowl@gmail.com>
date Wed, 09 Jan 2013 10:13:57 +0000
parents 8a716cbc3db8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1418
af8675f5e463 test suite now pygame.tests subpackage as well
Lenard Lindstrom <len-l@telus.net>
parents: 1261
diff changeset
1 if __name__ == '__main__':
af8675f5e463 test suite now pygame.tests subpackage as well
Lenard Lindstrom <len-l@telus.net>
parents: 1261
diff changeset
2 import sys
af8675f5e463 test suite now pygame.tests subpackage as well
Lenard Lindstrom <len-l@telus.net>
parents: 1261
diff changeset
3 import os
af8675f5e463 test suite now pygame.tests subpackage as well
Lenard Lindstrom <len-l@telus.net>
parents: 1261
diff changeset
4 pkg_dir = os.path.split(os.path.abspath(__file__))[0]
af8675f5e463 test suite now pygame.tests subpackage as well
Lenard Lindstrom <len-l@telus.net>
parents: 1261
diff changeset
5 parent_dir, pkg_name = os.path.split(pkg_dir)
af8675f5e463 test suite now pygame.tests subpackage as well
Lenard Lindstrom <len-l@telus.net>
parents: 1261
diff changeset
6 is_pygame_pkg = (pkg_name == 'tests' and
af8675f5e463 test suite now pygame.tests subpackage as well
Lenard Lindstrom <len-l@telus.net>
parents: 1261
diff changeset
7 os.path.split(parent_dir)[1] == 'pygame')
af8675f5e463 test suite now pygame.tests subpackage as well
Lenard Lindstrom <len-l@telus.net>
parents: 1261
diff changeset
8 if not is_pygame_pkg:
af8675f5e463 test suite now pygame.tests subpackage as well
Lenard Lindstrom <len-l@telus.net>
parents: 1261
diff changeset
9 sys.path.insert(0, parent_dir)
af8675f5e463 test suite now pygame.tests subpackage as well
Lenard Lindstrom <len-l@telus.net>
parents: 1261
diff changeset
10 else:
af8675f5e463 test suite now pygame.tests subpackage as well
Lenard Lindstrom <len-l@telus.net>
parents: 1261
diff changeset
11 is_pygame_pkg = __name__.startswith('pygame.tests.')
af8675f5e463 test suite now pygame.tests subpackage as well
Lenard Lindstrom <len-l@telus.net>
parents: 1261
diff changeset
12
af8675f5e463 test suite now pygame.tests subpackage as well
Lenard Lindstrom <len-l@telus.net>
parents: 1261
diff changeset
13 if is_pygame_pkg:
af8675f5e463 test suite now pygame.tests subpackage as well
Lenard Lindstrom <len-l@telus.net>
parents: 1261
diff changeset
14 from pygame.tests.test_utils import test_not_implemented, unittest
af8675f5e463 test suite now pygame.tests subpackage as well
Lenard Lindstrom <len-l@telus.net>
parents: 1261
diff changeset
15 else:
af8675f5e463 test suite now pygame.tests subpackage as well
Lenard Lindstrom <len-l@telus.net>
parents: 1261
diff changeset
16 from test.test_utils import test_not_implemented, unittest
1239
1843b3eb8769 made trunk/test a package, added in python2.5 version of unittest as test.unittest.
akalias
parents: 1230
diff changeset
17 import pygame
2113
8a716cbc3db8 disable building of modules altered in fsencoding branch to try and discover where the Mac GCC build error is.
Lenard Lindstrom <len-l@telus.net>
parents: 1604
diff changeset
18 import sys
313
e6ad6377009d unit test and rect fixes
pygame
parents:
diff changeset
19
e6ad6377009d unit test and rect fixes
pygame
parents:
diff changeset
20 init_called = quit_called = 0
e6ad6377009d unit test and rect fixes
pygame
parents:
diff changeset
21 def __PYGAMEinit__(): #called automatically by pygame.init()
e6ad6377009d unit test and rect fixes
pygame
parents:
diff changeset
22 global init_called
e6ad6377009d unit test and rect fixes
pygame
parents:
diff changeset
23 init_called = init_called + 1
e6ad6377009d unit test and rect fixes
pygame
parents:
diff changeset
24 pygame.register_quit(pygame_quit)
e6ad6377009d unit test and rect fixes
pygame
parents:
diff changeset
25 def pygame_quit():
e6ad6377009d unit test and rect fixes
pygame
parents:
diff changeset
26 global quit_called
e6ad6377009d unit test and rect fixes
pygame
parents:
diff changeset
27 quit_called = quit_called + 1
e6ad6377009d unit test and rect fixes
pygame
parents:
diff changeset
28
1227
c2cfb3b9d1ae Some more init tests
akalias
parents: 1220
diff changeset
29
c2cfb3b9d1ae Some more init tests
akalias
parents: 1220
diff changeset
30 quit_hook_ran = 0
c2cfb3b9d1ae Some more init tests
akalias
parents: 1220
diff changeset
31 def quit_hook():
c2cfb3b9d1ae Some more init tests
akalias
parents: 1220
diff changeset
32 global quit_hook_ran
c2cfb3b9d1ae Some more init tests
akalias
parents: 1220
diff changeset
33 quit_hook_ran = 1
c2cfb3b9d1ae Some more init tests
akalias
parents: 1220
diff changeset
34
1148
1d1ed35fb837 Added in many test stubs, hopefully some test faeries will fill some of them out.
akalias
parents: 313
diff changeset
35 class BaseModuleTest(unittest.TestCase):
313
e6ad6377009d unit test and rect fixes
pygame
parents:
diff changeset
36 def testAutoInit(self):
e6ad6377009d unit test and rect fixes
pygame
parents:
diff changeset
37 pygame.init()
e6ad6377009d unit test and rect fixes
pygame
parents:
diff changeset
38 pygame.quit()
e6ad6377009d unit test and rect fixes
pygame
parents:
diff changeset
39 self.assertEqual(init_called, 1)
e6ad6377009d unit test and rect fixes
pygame
parents:
diff changeset
40 self.assertEqual(quit_called, 1)
e6ad6377009d unit test and rect fixes
pygame
parents:
diff changeset
41
1148
1d1ed35fb837 Added in many test stubs, hopefully some test faeries will fill some of them out.
akalias
parents: 313
diff changeset
42 def test_get_sdl_byteorder(self):
1d1ed35fb837 Added in many test stubs, hopefully some test faeries will fill some of them out.
akalias
parents: 313
diff changeset
43
1d1ed35fb837 Added in many test stubs, hopefully some test faeries will fill some of them out.
akalias
parents: 313
diff changeset
44 # __doc__ (as of 2008-06-25) for pygame.base.get_sdl_byteorder:
1d1ed35fb837 Added in many test stubs, hopefully some test faeries will fill some of them out.
akalias
parents: 313
diff changeset
45
1d1ed35fb837 Added in many test stubs, hopefully some test faeries will fill some of them out.
akalias
parents: 313
diff changeset
46 # pygame.get_sdl_byteorder(): return int
1d1ed35fb837 Added in many test stubs, hopefully some test faeries will fill some of them out.
akalias
parents: 313
diff changeset
47 # get the byte order of SDL
1d1ed35fb837 Added in many test stubs, hopefully some test faeries will fill some of them out.
akalias
parents: 313
diff changeset
48
1230
8b4151a9ffe6 disabling pygame.init/quit test that broke mac build while investigating
akalias
parents: 1227
diff changeset
49 self.assert_(pygame.get_sdl_byteorder() + 1)
1148
1d1ed35fb837 Added in many test stubs, hopefully some test faeries will fill some of them out.
akalias
parents: 313
diff changeset
50
1d1ed35fb837 Added in many test stubs, hopefully some test faeries will fill some of them out.
akalias
parents: 313
diff changeset
51 def test_get_sdl_version(self):
1d1ed35fb837 Added in many test stubs, hopefully some test faeries will fill some of them out.
akalias
parents: 313
diff changeset
52
1d1ed35fb837 Added in many test stubs, hopefully some test faeries will fill some of them out.
akalias
parents: 313
diff changeset
53 # __doc__ (as of 2008-06-25) for pygame.base.get_sdl_version:
1d1ed35fb837 Added in many test stubs, hopefully some test faeries will fill some of them out.
akalias
parents: 313
diff changeset
54
1d1ed35fb837 Added in many test stubs, hopefully some test faeries will fill some of them out.
akalias
parents: 313
diff changeset
55 # pygame.get_sdl_version(): return major, minor, patch
1d1ed35fb837 Added in many test stubs, hopefully some test faeries will fill some of them out.
akalias
parents: 313
diff changeset
56 # get the version number of SDL
1d1ed35fb837 Added in many test stubs, hopefully some test faeries will fill some of them out.
akalias
parents: 313
diff changeset
57
1227
c2cfb3b9d1ae Some more init tests
akalias
parents: 1220
diff changeset
58 self.assert_( len(pygame.get_sdl_version()) == 3)
1148
1d1ed35fb837 Added in many test stubs, hopefully some test faeries will fill some of them out.
akalias
parents: 313
diff changeset
59
1227
c2cfb3b9d1ae Some more init tests
akalias
parents: 1220
diff changeset
60 def not_init_assertions(self):
1567
97c361c26782 OS X now passes tests. See if the problem in base_test.py is with scrap
Lenard Lindstrom <len-l@telus.net>
parents: 1561
diff changeset
61 self.assert_(not pygame.display.get_init(),
97c361c26782 OS X now passes tests. See if the problem in base_test.py is with scrap
Lenard Lindstrom <len-l@telus.net>
parents: 1561
diff changeset
62 "display shouldn't be initialized" )
2113
8a716cbc3db8 disable building of modules altered in fsencoding branch to try and discover where the Mac GCC build error is.
Lenard Lindstrom <len-l@telus.net>
parents: 1604
diff changeset
63 if 'pygame.mixer' in sys.modules:
8a716cbc3db8 disable building of modules altered in fsencoding branch to try and discover where the Mac GCC build error is.
Lenard Lindstrom <len-l@telus.net>
parents: 1604
diff changeset
64 self.assert_(not pygame.mixer.get_init(),
8a716cbc3db8 disable building of modules altered in fsencoding branch to try and discover where the Mac GCC build error is.
Lenard Lindstrom <len-l@telus.net>
parents: 1604
diff changeset
65 "mixer shouldn't be initialized" )
8a716cbc3db8 disable building of modules altered in fsencoding branch to try and discover where the Mac GCC build error is.
Lenard Lindstrom <len-l@telus.net>
parents: 1604
diff changeset
66 if 'pygame.font' in sys.modules:
8a716cbc3db8 disable building of modules altered in fsencoding branch to try and discover where the Mac GCC build error is.
Lenard Lindstrom <len-l@telus.net>
parents: 1604
diff changeset
67 self.assert_(not pygame.font.get_init(),
8a716cbc3db8 disable building of modules altered in fsencoding branch to try and discover where the Mac GCC build error is.
Lenard Lindstrom <len-l@telus.net>
parents: 1604
diff changeset
68 "init shouldn't be initialized" )
1567
97c361c26782 OS X now passes tests. See if the problem in base_test.py is with scrap
Lenard Lindstrom <len-l@telus.net>
parents: 1561
diff changeset
69
1577
bdd71469e307 try to allow scrap test in base_test.py on non-OS X platforms
Lenard Lindstrom <len-l@telus.net>
parents: 1575
diff changeset
70 ## !!! TODO : Remove when scrap works for OS X
bdd71469e307 try to allow scrap test in base_test.py on non-OS X platforms
Lenard Lindstrom <len-l@telus.net>
parents: 1575
diff changeset
71 import platform
bdd71469e307 try to allow scrap test in base_test.py on non-OS X platforms
Lenard Lindstrom <len-l@telus.net>
parents: 1575
diff changeset
72 if platform.system().startswith('Darwin'):
bdd71469e307 try to allow scrap test in base_test.py on non-OS X platforms
Lenard Lindstrom <len-l@telus.net>
parents: 1575
diff changeset
73 return
1604
e87063486367 fix transform.threshold bug involving a long threshold
Lenard Lindstrom <len-l@telus.net>
parents: 1577
diff changeset
74
e87063486367 fix transform.threshold bug involving a long threshold
Lenard Lindstrom <len-l@telus.net>
parents: 1577
diff changeset
75 try:
e87063486367 fix transform.threshold bug involving a long threshold
Lenard Lindstrom <len-l@telus.net>
parents: 1577
diff changeset
76 self.assertRaises(pygame.error, pygame.scrap.get)
e87063486367 fix transform.threshold bug involving a long threshold
Lenard Lindstrom <len-l@telus.net>
parents: 1577
diff changeset
77 except NotImplementedError:
e87063486367 fix transform.threshold bug involving a long threshold
Lenard Lindstrom <len-l@telus.net>
parents: 1577
diff changeset
78 # Scrap is optional.
e87063486367 fix transform.threshold bug involving a long threshold
Lenard Lindstrom <len-l@telus.net>
parents: 1577
diff changeset
79 pass
1227
c2cfb3b9d1ae Some more init tests
akalias
parents: 1220
diff changeset
80
c2cfb3b9d1ae Some more init tests
akalias
parents: 1220
diff changeset
81 # pygame.cdrom
c2cfb3b9d1ae Some more init tests
akalias
parents: 1220
diff changeset
82 # pygame.joystick
1148
1d1ed35fb837 Added in many test stubs, hopefully some test faeries will fill some of them out.
akalias
parents: 313
diff changeset
83
1227
c2cfb3b9d1ae Some more init tests
akalias
parents: 1220
diff changeset
84 def init_assertions(self):
c2cfb3b9d1ae Some more init tests
akalias
parents: 1220
diff changeset
85 self.assert_(pygame.display.get_init())
2113
8a716cbc3db8 disable building of modules altered in fsencoding branch to try and discover where the Mac GCC build error is.
Lenard Lindstrom <len-l@telus.net>
parents: 1604
diff changeset
86 if 'pygame.mixer' in sys.modules:
8a716cbc3db8 disable building of modules altered in fsencoding branch to try and discover where the Mac GCC build error is.
Lenard Lindstrom <len-l@telus.net>
parents: 1604
diff changeset
87 self.assert_(pygame.mixer.get_init())
8a716cbc3db8 disable building of modules altered in fsencoding branch to try and discover where the Mac GCC build error is.
Lenard Lindstrom <len-l@telus.net>
parents: 1604
diff changeset
88 if 'pygame.font' in sys.modules:
8a716cbc3db8 disable building of modules altered in fsencoding branch to try and discover where the Mac GCC build error is.
Lenard Lindstrom <len-l@telus.net>
parents: 1604
diff changeset
89 self.assert_(pygame.font.get_init())
1227
c2cfb3b9d1ae Some more init tests
akalias
parents: 1220
diff changeset
90
1553
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
91 def test_quit__and_init(self):
1148
1d1ed35fb837 Added in many test stubs, hopefully some test faeries will fill some of them out.
akalias
parents: 313
diff changeset
92 # __doc__ (as of 2008-06-25) for pygame.base.quit:
1d1ed35fb837 Added in many test stubs, hopefully some test faeries will fill some of them out.
akalias
parents: 313
diff changeset
93
1d1ed35fb837 Added in many test stubs, hopefully some test faeries will fill some of them out.
akalias
parents: 313
diff changeset
94 # pygame.quit(): return None
1d1ed35fb837 Added in many test stubs, hopefully some test faeries will fill some of them out.
akalias
parents: 313
diff changeset
95 # uninitialize all pygame modules
1227
c2cfb3b9d1ae Some more init tests
akalias
parents: 1220
diff changeset
96
c2cfb3b9d1ae Some more init tests
akalias
parents: 1220
diff changeset
97 # Make sure everything is not init
1561
040573e5e6ef more OS X testing of base_test.py
Lenard Lindstrom <len-l@telus.net>
parents: 1560
diff changeset
98 self.not_init_assertions()
1227
c2cfb3b9d1ae Some more init tests
akalias
parents: 1220
diff changeset
99
1230
8b4151a9ffe6 disabling pygame.init/quit test that broke mac build while investigating
akalias
parents: 1227
diff changeset
100 # Initiate it
1227
c2cfb3b9d1ae Some more init tests
akalias
parents: 1220
diff changeset
101 pygame.init()
c2cfb3b9d1ae Some more init tests
akalias
parents: 1220
diff changeset
102
c2cfb3b9d1ae Some more init tests
akalias
parents: 1220
diff changeset
103 # Check
c2cfb3b9d1ae Some more init tests
akalias
parents: 1220
diff changeset
104 self.init_assertions()
1148
1d1ed35fb837 Added in many test stubs, hopefully some test faeries will fill some of them out.
akalias
parents: 313
diff changeset
105
1227
c2cfb3b9d1ae Some more init tests
akalias
parents: 1220
diff changeset
106 # Quit
c2cfb3b9d1ae Some more init tests
akalias
parents: 1220
diff changeset
107 pygame.quit()
c2cfb3b9d1ae Some more init tests
akalias
parents: 1220
diff changeset
108
c2cfb3b9d1ae Some more init tests
akalias
parents: 1220
diff changeset
109 # All modules have quit
c2cfb3b9d1ae Some more init tests
akalias
parents: 1220
diff changeset
110 self.not_init_assertions()
1148
1d1ed35fb837 Added in many test stubs, hopefully some test faeries will fill some of them out.
akalias
parents: 313
diff changeset
111
1d1ed35fb837 Added in many test stubs, hopefully some test faeries will fill some of them out.
akalias
parents: 313
diff changeset
112 def test_register_quit(self):
1d1ed35fb837 Added in many test stubs, hopefully some test faeries will fill some of them out.
akalias
parents: 313
diff changeset
113
1d1ed35fb837 Added in many test stubs, hopefully some test faeries will fill some of them out.
akalias
parents: 313
diff changeset
114 # __doc__ (as of 2008-06-25) for pygame.base.register_quit:
1d1ed35fb837 Added in many test stubs, hopefully some test faeries will fill some of them out.
akalias
parents: 313
diff changeset
115
1d1ed35fb837 Added in many test stubs, hopefully some test faeries will fill some of them out.
akalias
parents: 313
diff changeset
116 # register_quit(callable): return None
1d1ed35fb837 Added in many test stubs, hopefully some test faeries will fill some of them out.
akalias
parents: 313
diff changeset
117 # register a function to be called when pygame quits
1227
c2cfb3b9d1ae Some more init tests
akalias
parents: 1220
diff changeset
118
c2cfb3b9d1ae Some more init tests
akalias
parents: 1220
diff changeset
119 self.assert_(not quit_hook_ran)
1148
1d1ed35fb837 Added in many test stubs, hopefully some test faeries will fill some of them out.
akalias
parents: 313
diff changeset
120
1227
c2cfb3b9d1ae Some more init tests
akalias
parents: 1220
diff changeset
121 pygame.init()
c2cfb3b9d1ae Some more init tests
akalias
parents: 1220
diff changeset
122 pygame.register_quit(quit_hook)
c2cfb3b9d1ae Some more init tests
akalias
parents: 1220
diff changeset
123 pygame.quit()
c2cfb3b9d1ae Some more init tests
akalias
parents: 1220
diff changeset
124
c2cfb3b9d1ae Some more init tests
akalias
parents: 1220
diff changeset
125 self.assert_(quit_hook_ran)
1148
1d1ed35fb837 Added in many test stubs, hopefully some test faeries will fill some of them out.
akalias
parents: 313
diff changeset
126
1553
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
127 def test_get_error(self):
1261
f3691359950b Made all unimplemented tests use todo_test_xxxx naming and updated the __doc__'s. Run's only implemented tests by default.
akalias
parents: 1239
diff changeset
128
f3691359950b Made all unimplemented tests use todo_test_xxxx naming and updated the __doc__'s. Run's only implemented tests by default.
akalias
parents: 1239
diff changeset
129 # __doc__ (as of 2008-08-02) for pygame.base.get_error:
f3691359950b Made all unimplemented tests use todo_test_xxxx naming and updated the __doc__'s. Run's only implemented tests by default.
akalias
parents: 1239
diff changeset
130
f3691359950b Made all unimplemented tests use todo_test_xxxx naming and updated the __doc__'s. Run's only implemented tests by default.
akalias
parents: 1239
diff changeset
131 # pygame.get_error(): return errorstr
f3691359950b Made all unimplemented tests use todo_test_xxxx naming and updated the __doc__'s. Run's only implemented tests by default.
akalias
parents: 1239
diff changeset
132 # get the current error message
f3691359950b Made all unimplemented tests use todo_test_xxxx naming and updated the __doc__'s. Run's only implemented tests by default.
akalias
parents: 1239
diff changeset
133 #
f3691359950b Made all unimplemented tests use todo_test_xxxx naming and updated the __doc__'s. Run's only implemented tests by default.
akalias
parents: 1239
diff changeset
134 # SDL maintains an internal error message. This message will usually
f3691359950b Made all unimplemented tests use todo_test_xxxx naming and updated the __doc__'s. Run's only implemented tests by default.
akalias
parents: 1239
diff changeset
135 # be given to you when pygame.error is raised. You will rarely need to
f3691359950b Made all unimplemented tests use todo_test_xxxx naming and updated the __doc__'s. Run's only implemented tests by default.
akalias
parents: 1239
diff changeset
136 # call this function.
f3691359950b Made all unimplemented tests use todo_test_xxxx naming and updated the __doc__'s. Run's only implemented tests by default.
akalias
parents: 1239
diff changeset
137 #
f3691359950b Made all unimplemented tests use todo_test_xxxx naming and updated the __doc__'s. Run's only implemented tests by default.
akalias
parents: 1239
diff changeset
138
1553
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
139 self.assertEqual(pygame.get_error(), "")
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
140 pygame.set_error("hi")
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
141 self.assertEqual(pygame.get_error(), "hi")
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
142 pygame.set_error("")
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
143 self.assertEqual(pygame.get_error(), "")
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
144
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
145
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
146
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
147 def test_set_error(self):
1261
f3691359950b Made all unimplemented tests use todo_test_xxxx naming and updated the __doc__'s. Run's only implemented tests by default.
akalias
parents: 1239
diff changeset
148
1553
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
149 self.assertEqual(pygame.get_error(), "")
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
150 pygame.set_error("hi")
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
151 self.assertEqual(pygame.get_error(), "hi")
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
152 pygame.set_error("")
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
153 self.assertEqual(pygame.get_error(), "")
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
154
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
155
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
156
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
157 def test_init(self):
1261
f3691359950b Made all unimplemented tests use todo_test_xxxx naming and updated the __doc__'s. Run's only implemented tests by default.
akalias
parents: 1239
diff changeset
158
f3691359950b Made all unimplemented tests use todo_test_xxxx naming and updated the __doc__'s. Run's only implemented tests by default.
akalias
parents: 1239
diff changeset
159 # __doc__ (as of 2008-08-02) for pygame.base.init:
1148
1d1ed35fb837 Added in many test stubs, hopefully some test faeries will fill some of them out.
akalias
parents: 313
diff changeset
160
1557
6b581f917c95 clean up METH_NOARG functions which were accidently given a second C argument in display.c
Lenard Lindstrom <len-l@telus.net>
parents: 1553
diff changeset
161 # pygame.init(): return (numpass, numfail)
6b581f917c95 clean up METH_NOARG functions which were accidently given a second C argument in display.c
Lenard Lindstrom <len-l@telus.net>
parents: 1553
diff changeset
162 # initialize all imported pygame modules
6b581f917c95 clean up METH_NOARG functions which were accidently given a second C argument in display.c
Lenard Lindstrom <len-l@telus.net>
parents: 1553
diff changeset
163 #
6b581f917c95 clean up METH_NOARG functions which were accidently given a second C argument in display.c
Lenard Lindstrom <len-l@telus.net>
parents: 1553
diff changeset
164 # Initialize all imported Pygame modules. No exceptions will be raised
6b581f917c95 clean up METH_NOARG functions which were accidently given a second C argument in display.c
Lenard Lindstrom <len-l@telus.net>
parents: 1553
diff changeset
165 # if a module fails, but the total number if successful and failed
6b581f917c95 clean up METH_NOARG functions which were accidently given a second C argument in display.c
Lenard Lindstrom <len-l@telus.net>
parents: 1553
diff changeset
166 # inits will be returned as a tuple. You can always initialize
6b581f917c95 clean up METH_NOARG functions which were accidently given a second C argument in display.c
Lenard Lindstrom <len-l@telus.net>
parents: 1553
diff changeset
167 # individual modules manually, but pygame.init is a convenient way to
6b581f917c95 clean up METH_NOARG functions which were accidently given a second C argument in display.c
Lenard Lindstrom <len-l@telus.net>
parents: 1553
diff changeset
168 # get everything started. The init() functions for individual modules
6b581f917c95 clean up METH_NOARG functions which were accidently given a second C argument in display.c
Lenard Lindstrom <len-l@telus.net>
parents: 1553
diff changeset
169 # will raise exceptions when they fail.
6b581f917c95 clean up METH_NOARG functions which were accidently given a second C argument in display.c
Lenard Lindstrom <len-l@telus.net>
parents: 1553
diff changeset
170 #
6b581f917c95 clean up METH_NOARG functions which were accidently given a second C argument in display.c
Lenard Lindstrom <len-l@telus.net>
parents: 1553
diff changeset
171 # You may want to initalise the different modules seperately to speed
6b581f917c95 clean up METH_NOARG functions which were accidently given a second C argument in display.c
Lenard Lindstrom <len-l@telus.net>
parents: 1553
diff changeset
172 # up your program or to not use things your game does not.
6b581f917c95 clean up METH_NOARG functions which were accidently given a second C argument in display.c
Lenard Lindstrom <len-l@telus.net>
parents: 1553
diff changeset
173 #
6b581f917c95 clean up METH_NOARG functions which were accidently given a second C argument in display.c
Lenard Lindstrom <len-l@telus.net>
parents: 1553
diff changeset
174 # It is safe to call this init() more than once: repeated calls will
6b581f917c95 clean up METH_NOARG functions which were accidently given a second C argument in display.c
Lenard Lindstrom <len-l@telus.net>
parents: 1553
diff changeset
175 # have no effect. This is true even if you have pygame.quit() all the
6b581f917c95 clean up METH_NOARG functions which were accidently given a second C argument in display.c
Lenard Lindstrom <len-l@telus.net>
parents: 1553
diff changeset
176 # modules.
6b581f917c95 clean up METH_NOARG functions which were accidently given a second C argument in display.c
Lenard Lindstrom <len-l@telus.net>
parents: 1553
diff changeset
177 #
1261
f3691359950b Made all unimplemented tests use todo_test_xxxx naming and updated the __doc__'s. Run's only implemented tests by default.
akalias
parents: 1239
diff changeset
178
1553
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
179
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
180
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
181 # Make sure everything is not init
1561
040573e5e6ef more OS X testing of base_test.py
Lenard Lindstrom <len-l@telus.net>
parents: 1560
diff changeset
182 self.not_init_assertions()
1553
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
183
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
184 # Initiate it
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
185 pygame.init()
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
186
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
187 # Check
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
188 self.init_assertions()
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
189
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
190 # Quit
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
191 pygame.quit()
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
192
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
193 # All modules have quit
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
194 self.not_init_assertions()
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
195
1261
f3691359950b Made all unimplemented tests use todo_test_xxxx naming and updated the __doc__'s. Run's only implemented tests by default.
akalias
parents: 1239
diff changeset
196
f3691359950b Made all unimplemented tests use todo_test_xxxx naming and updated the __doc__'s. Run's only implemented tests by default.
akalias
parents: 1239
diff changeset
197 def todo_test_segfault(self):
f3691359950b Made all unimplemented tests use todo_test_xxxx naming and updated the __doc__'s. Run's only implemented tests by default.
akalias
parents: 1239
diff changeset
198
f3691359950b Made all unimplemented tests use todo_test_xxxx naming and updated the __doc__'s. Run's only implemented tests by default.
akalias
parents: 1239
diff changeset
199 # __doc__ (as of 2008-08-02) for pygame.base.segfault:
1148
1d1ed35fb837 Added in many test stubs, hopefully some test faeries will fill some of them out.
akalias
parents: 313
diff changeset
200
1d1ed35fb837 Added in many test stubs, hopefully some test faeries will fill some of them out.
akalias
parents: 313
diff changeset
201 # crash
1d1ed35fb837 Added in many test stubs, hopefully some test faeries will fill some of them out.
akalias
parents: 313
diff changeset
202
1261
f3691359950b Made all unimplemented tests use todo_test_xxxx naming and updated the __doc__'s. Run's only implemented tests by default.
akalias
parents: 1239
diff changeset
203 self.fail()
313
e6ad6377009d unit test and rect fixes
pygame
parents:
diff changeset
204
e6ad6377009d unit test and rect fixes
pygame
parents:
diff changeset
205 if __name__ == '__main__':
1418
af8675f5e463 test suite now pygame.tests subpackage as well
Lenard Lindstrom <len-l@telus.net>
parents: 1261
diff changeset
206 unittest.main()