================================================================================
= README FOR PYGAME TESTS =
===========================
================================================================================
= run_tests.py =
================
The test runner for PyGame was developed for these purposes:
* Per process isolation of test modules
* Ability to tag tests for exclusion (interactive tests etc)
* Record timings of tests
It does this by altering the behaviour of unittest at run time. As much as
possible each individual module was left to be fully compatible with the
standard unittest. At one point it was discovered that the run time patching of
unittest was incompatible with the 2.4 version so a copy of the 2.5 version now
is included in the pygame test directory. The test directory was made a
package.
If an individual module is run, eg ``python test/color_test.py``, then it will
run an unmodified version of unittest. ( unittest.main() )
================================================================================
= Creating New Test Modules =
=============================
*** NOTE ***
Be sure to import test_utils first at the top of your file, this will set the
sys.path required for test.unittest to run, otherwise run_tests.py will not work
properly
import test_utils
import test.unittest as unittest
================================================================================
= Writing New Tests =
=====================
See test/util/gen_stubs.py for automatic creation of test stubs
Follow the naming convention
================================================================================
= gen_stubs.py =
================
trunk/test/util/gen_stubs.py
The gen_stubs.py utility will inspect pygame, and compile stubs of each of the
module's callables (funcs, methods, getter/setters). It will include in the
test's comment the __doc__ and the documentation found in the relevant xxxx.doc
files. There is a naming convention in place that maps test names to callables
in a one to one manner. If there are no untested (or unstubbed) callables then
gen_stubs.py will output nothing.
gen_stubs.py --help
gen_stubs.py module -d >> ../test_module_to_append_to.py
You will need to manually merge the stubs into relevant TestCases.
================================================================================
= Test Naming Convention =
==========================
This convention is in place so the stub generator can tell what has already been
tested and for other introspection purposes.
Each module in the pygame package has a corresponding test module in the
trunk/test directory.
pygame.color : color_test.py
Each class has corresponding TestCase[s] in form of $Class + "Type"
# TC[:TC.rindex('Type')]
pygame.color.Color : color_test.ColorTypeTest
pygame.color.Color : color_test.ColorTypeTestOtherAspect
*** NOTE ***
Use the names of the instantiator helper functions:
eg pygame.cdrom.CD and not pygame.cdrom.CDType
Each test should be named in the form, test_$funcname__$comment
Surface.blit : test_blit__raises_exception_if_locked
================================================================================
= Tagging =
===========
There are three levels of tagging available, module level, TestCase level and
individual test level.
For class and module level tagging assign a tag attribute __tags__ = []
Module Level Tags
-----------------
Include the module level tags in: 'some_module_tags.py'
Where the module name is 'some_module' which has its tests in some_module_test.py
This allows some modules to be excluded without loading some code in the first place.
# some_module_test.py
__tags__ = ['display', 'interactive']
Tags are inherited by children, so all TestCases, and thus tests will inherit
these module level tags.
Class Level Tags
----------------
If you want to override a specifig tag then you can use negation.
class SomeTest(unittest.TestCase):
__tags__ = ['-interactive']
Test Level Tags
---------------
The tags for individual tests are specified in the __doc__ for the test.
format : |Tags:comma,separated,tags|
def test_something__about_something(self):
"""
|Tags:interactive,some_other_tag|
"""
*** NOTE ***
By default 'interactive' tags are not run
run_tests.py --exclude display,slow for exclusion of tags
However if you do python test/some_module_test.py all of the tests will run.
See run_tests.py --help for more details.
================================================================================
= test_utils.py =
=================
This contains utility routines for common testing needs as well as sets the
sys.path required for test.unittest to work.
some convenience functions:
question(q)
Will ask q and return True if they answered yes
prompt(p)
Will notify the user of p and then prompt them to "press enter to continue"
trunk_relative_path(pth)
Will return a normalized relative path, relative to the test_module
eg trunk_relative_path('examples\\data\\alien.jpg') will work on linux
This is so the test module can be run from anywhere with working paths
eg ../test/color_test.py
fixture_path(pth)
Likewise but paths are relative to trunk\test\fixtures
example_path(pth)
Likewise but paths are relative to trunk\examples
================================================================================
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
官网下载太慢了。pygame-1.9.3-cp35-cp35m-win_amd64.whl、pygame-1.9.3-cp34-cp34m-win_amd64.whl、pygame-1.9.3-cp27-cp27m-win_amd64.whl、pygame-1.9.3-cp36-cp36m-win_amd64.whl及其源码
资源推荐
资源详情
资源评论
收起资源包目录
pygame-1.9.3的64位的wheel文件 (549个子文件)
remote_push.bat 54B
PyGameMono-18-100dpi.bdf 2KB
PyGameMono-18-75dpi.bdf 2KB
PyGameMono-8.bdf 1KB
arraydemo.bmp 75KB
liquid.bmp 11KB
chimp.bmp 5KB
fist.bmp 4KB
pygame_icon.bmp 630B
asprite.bmp 578B
BUILD_FAILED 0B
BUILD_FAILED_EXCEPTION 0B
BUILD_FAILED_UNKNOWN 0B
BUILD_FAILED_UNPARSEABLE 0B
BUILD_LINK_FAILED 0B
BUILD_SUCCESSFUL 56KB
pypm.c 225KB
SDL_gfxPrimitives.c 158KB
math.c 112KB
surface.c 96KB
transform.c 87KB
alphablit.c 80KB
_freetype.c 62KB
pixelarray.c 57KB
base.c 55KB
_camera.c 54KB
color.c 52KB
mixer.c 50KB
draw.c 48KB
mask.c 45KB
image.c 45KB
rect.c 43KB
ft_render_cb.c 36KB
pixelcopy.c 35KB
pixelarray_methods.c 32KB
gfxdraw.c 31KB
scale_mmx64.c 31KB
scale_mmx32.c 31KB
newbuffer.c 30KB
display.c 30KB
scale_mmx64_gcc.c 29KB
event.c 29KB
bitmask.c 27KB
bufferproxy.c 27KB
scrap_x11.c 25KB
surface_fill.c 25KB
ft_layout.c 24KB
ft_render.c 23KB
font.c 23KB
imageext.c 21KB
camera_v4l2.c 19KB
rotozoom.c 19KB
rwobject.c 17KB
cdrom.c 17KB
ft_wrap.c 14KB
joystick.c 14KB
music.c 12KB
time.c 12KB
constants.c 11KB
scrap_win.c 10KB
fastevent.c 9KB
scrap.c 9KB
surflock.c 9KB
overlay.c 8KB
ft_cache.c 8KB
scale2x.c 7KB
mouse.c 7KB
scrap_qnx.c 6KB
ft_unicode.c 5KB
key.c 4KB
scale_mmx64_msvc.c 4KB
fastevents.c 4KB
scrap_mac.c 2KB
scale_mmx.c 1KB
setup.cfg 59B
theme.conf 1KB
results.css 1KB
reset.css 1KB
tooltip.css 798B
pygame.css_t 13KB
pygame_logo.gif 25KB
chimpshot.gif 11KB
pygame_small.gif 10KB
pygame_powered.gif 10KB
background.gif 9KB
explosion1.gif 6KB
pygame_tiny.gif 5KB
intro_ball.gif 5KB
alien2.gif 4KB
alien3.gif 4KB
alien1.gif 4KB
player1.gif 3KB
danger.gif 3KB
bomb.gif 1KB
oldplayer.gif 1KB
shot.gif 129B
SDL_gfxPrimitives_font.h 55KB
_pygame.h 27KB
ft_wrap.h 14KB
surface.h 13KB
共 549 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
- TomHEU2018-07-13good source
aganliang
- 粉丝: 339
- 资源: 8
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功