Python??????: ????????????
???????????? ???????[ 2015/10/16 15:33:40 ] ??????????????? ???????
????Python ?????????????????????????????????????????????????????????ó???**?????????????????????????????????
????????????????? Python ??????? ?????????? ?????????????е? ???????? ?????? zope.testing??py.test ?? nose???????????????? Python ?????д???????????????????????ε?????????????????????????з??????????????????в???????????????????????????????????ò????????????????
????Python ??????????
????Python ??????????????????????????????????????????????????? Python ????б?д????????????д?????? test_all.py ?? tests.py ???????????????????????????в????????????????????????????????????????????????????????????????????????????????????????????????????ε?????????????? Python ????????????????????????????????????????????
????test_all.py??????????????????????????????????????????????????????·?????????????е?????б????????????????????????????μ??????????????????????????????????????????У???????? Python ????????????????β??????????????
?????????????????????????????????????????????????????????????????????????????С?????? Python ?????????Щ Python ??????????????????????????
# test_old.py - The old way of doing things
import unittest
class TruthTest(unittest.TestCase):
def testTrue(self):
ass** True == 1
def testFalse(self):
ass** False == 0
if __name__ == '__main__':
unittest.main()
????????е? ???????? ???????????? TestCase ?????????????????????????????????????????????????У????????????????????????????????????е?????????? test_old.py ???????????????£???????????? unittest ??????????????????????????????????????????????????????????????????????Χ??????????????С?
???????????????????????????????и??????????????鷳??????????????????????????????????????????? test_main() ?????????????????????????????????????????????????????????????????????????????????????????????????????з?????????в???
????Python ???????????
???????????? Python ???????????????????????????????????????????????Щ????????????????
????????????????????????????????????????в????????????????????? Python ???????????????????????????????
????zope.testing ?????в??????????????????? Zope ?????????????? buildout ????????????????????? buildout.cfg ????е? zc.recipe.testrunner recipe ??????????????????????????????????£?????????????? Zope ????У????? buildout ????????? ./bin/test ???????????????????????????
????py.test ?? nose ???????????????????????????????й????????????????????????????????????
????# Run "py.test" on the project
????# in the current directory...
????$ py.test
????# Run "nose" on the project
????# in the current directory...
????$ nosetests
????py.test ?? nosetests ?????????м????????????????????? -v ???????в???????????????????????????????????????????????????????д???????? Python ????????
????????????к???????????????????? Python ???????????а?????? setup.py ???????????????????
????# Common commands supported by setup.py files
????$ python setup.py build
????$ python setup.py install
???????????? Python ?????? setuptools ??????? Python ??????? setup.py ????????????????????в???? test ????
????# If a project's setup.py uses "setuptools"
????# then it will provide a "test" command too
????$ python setup.py test
????????????????Σ?????????????μ?????? setup.py test?????????????????????????????? Python ????????????nose ??????????????? setup.py?????????????? nosetests ?????????????????????
# A setup.py file that uses "nose" for testing
from setuptools import setup
setup(
# ...
# package metadata
# ...
setup_requires = ['nose']??
test_suite = 'nose.collector'??
)
??????????????????? setup.py ?????????????????????????? nosetests????? nosetests ????????????????????????μ???????????????????? bug ????????????????????????????????????????? test_suite ??????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11