>From py.test you can get report on stdout with or without the missing line numbers displayed, a html report, an xml report for feeding into something like jenkins or annotated source code. These are the options for reporting that coverage has and pytest-cov allows any combinations of those that you want.
Further to that, the coverage data file is called .coverage and will be in the dir that you ran py.test from. You can then use coverage itself to operate on that if you wish. Such as coverage --help coverage report coverage html Ned has docs at http://nedbatchelder.com/code/coverage pytest-cov provides access to all the report types, but having a .coveragerc can be good to get more control over how coverage operates such as turning branch coverage on. On 22 May 2011 17:56, Baptiste Lepilleur <baptiste.lepill...@gmail.com> wrote: > That was it! > The restdoc mess was coming from an old version of the sources of py-1.3.4 > my third-parties sub-directory that py.test was attempting to execute. > The pytest-cov plug-in is exactly what I was looking for. > By the way, the documentation indicates that it is possible to use standard > coverage tool for result data analysis. Do those tool provided more info > than the html report? If so could you provide some relevant pointers (I've > never use python coverage tool before)? > Thanks a lot, > Baptiste. > 2011/5/22 meme dough <memedo...@gmail.com> >> >> You need an arg to --cov which is the source root you want covered. >> >> py.test -h >> >> coverage reporting with distributed testing support: >> --cov=path measure coverage for filesystem path >> (multi-allowed) >> >> Try something like: >> >> py.test --cov . src\nitroz\test_collections.py >> >> py.test --cov src src\nitroz\test_collections.py >> >> On 20 May 2011 07:53, Baptiste Lepilleur <baptiste.lepill...@gmail.com> >> wrote: >> > Thanks for the pointer concerning pip, I did not know you could search >> > using >> > it. >> > Now, I running into a strange missing import error when trying to the >> > test >> > with coverage: >> > E ImportError: No module named restdoc >> > Any ideas what could be the cause and what this module is? >> > Detail below: >> > py.test --cov src\nitroz\test_collections.py >> > ================================================= test session starts >> > ================================================= >> > platform win32 -- Python 3.2.0 -- pytest-2.0.3 >> > collected 0 items / 1 errors >> > Coverage.py warning: No data was collected. >> > ======================================================= ERRORS >> > ======================================================== >> > _________________________________________________ ERROR collecting . >> > __________________________________________________ >> > C:\Python32\lib\site-packages\py-1.4.3-py3.2.egg\py\_path\common.py:312: >> > in >> > visit >> >> for x in Visitor(fil, rec, ignore, bf, sort).gen(self): >> > C:\Python32\lib\site-packages\py-1.4.3-py3.2.egg\py\_path\common.py:358: >> > in >> > gen >> >> for p in self.gen(subdir): >> > C:\Python32\lib\site-packages\py-1.4.3-py3.2.egg\py\_path\common.py:358: >> > in >> > gen >> >> for p in self.gen(subdir): >> > C:\Python32\lib\site-packages\py-1.4.3-py3.2.egg\py\_path\common.py:358: >> > in >> > gen >> >> for p in self.gen(subdir): >> > C:\Python32\lib\site-packages\py-1.4.3-py3.2.egg\py\_path\common.py:347: >> > in >> > gen >> >> dirs = self.optsort([p for p in entries >> > C:\Python32\lib\site-packages\py-1.4.3-py3.2.egg\py\_path\common.py:348: >> > in >> > <listcomp> >> >> if p.check(dir=1) and (rec is None or rec(p))]) >> > >> > C:\Python32\lib\site-packages\pytest-2.0.3-py3.2.egg\_pytest\main.py:450: >> > in >> > _recurse >> >> ihook.pytest_collect_directory(path=path, parent=self) >> > >> > C:\Python32\lib\site-packages\pytest-2.0.3-py3.2.egg\_pytest\main.py:118: >> > in >> > call_matching_hooks >> >> plugins = self.config._getmatchingplugins(self.fspath) >> > >> > C:\Python32\lib\site-packages\pytest-2.0.3-py3.2.egg\_pytest\config.py:283: >> > in _getmatchingplugins >> >> plugins += self._conftest.getconftestmodules(fspath) >> > >> > C:\Python32\lib\site-packages\pytest-2.0.3-py3.2.egg\_pytest\config.py:185: >> > in getconftestmodules >> >> clist.append(self.importconftest(conftestpath)) >> > >> > C:\Python32\lib\site-packages\pytest-2.0.3-py3.2.egg\_pytest\config.py:221: >> > in importconftest >> >> self._postimport(mod) >> > >> > C:\Python32\lib\site-packages\pytest-2.0.3-py3.2.egg\_pytest\config.py:226: >> > in _postimport >> >> self._onimport(mod) >> > >> > C:\Python32\lib\site-packages\pytest-2.0.3-py3.2.egg\_pytest\config.py:272: >> > in _onimportconftest >> >> self.pluginmanager.consider_conftest(conftestmodule) >> > >> > C:\Python32\lib\site-packages\pytest-2.0.3-py3.2.egg\_pytest\core.py:181: >> > in >> > consider_conftest >> >> self.consider_module(conftestmodule) >> > >> > C:\Python32\lib\site-packages\pytest-2.0.3-py3.2.egg\_pytest\core.py:189: >> > in >> > consider_module >> >> self.import_plugin(spec) >> > >> > C:\Python32\lib\site-packages\pytest-2.0.3-py3.2.egg\_pytest\core.py:202: >> > in >> > import_plugin >> >> return self.import_plugin(modname[7:]) >> > >> > C:\Python32\lib\site-packages\pytest-2.0.3-py3.2.egg\_pytest\core.py:197: >> > in >> > import_plugin >> >> mod = importplugin(modname) >> > >> > C:\Python32\lib\site-packages\pytest-2.0.3-py3.2.egg\_pytest\core.py:323: >> > in >> > importplugin >> >> return __import__(importspec, None, None, '__doc__') >> > E ImportError: No module named restdoc >> > ----------------------------------- coverage: platform win32, python >> > 3.2.0-final-0 ------------------------------------ >> > Name Stmts Miss Cover >> > --------------------------- >> > ============================================== 1 error in 18.02 seconds >> > =============================================== >> > >> > >> > 2011/5/18 holger krekel <hol...@merlinux.eu> >> >> >> >> Hey Baptiste, >> >> >> >> On Wed, May 18, 2011 at 17:42 +0200, Baptiste Lepilleur wrote: >> >> > The pytest documentation page indicates that it is supported, but >> >> > provides >> >> > no pointer on how do to this... >> >> >> >> > Doing a search seem to reveal multiple plug-ins to do that. What is >> >> > the >> >> > recommended one? I'm working on Windows XP / Python 2.6 & 3.2. >> >> >> >> sorry about that. The plugin is named pytest-cov, see here >> >> >> >> http://pypi.python.org/pypi/pytest-cov >> >> >> >> If it doesn't work for you i am sure Meme (also here on the list) >> >> can answer questions or to issues. >> >> >> >> > By the way, is there a centralized list of useful plug-ins for pytest >> >> > ? >> >> >> >> not really. However, i recommend to install "pip" and then type: >> >> >> >> pip search pytest >> >> >> >> to get a good list. >> >> >> >> best, >> >> holger >> >> >> >> >> >> >> >> > >> >> > Baptiste. >> >> >> >> > _______________________________________________ >> >> > py-dev mailing list >> >> > py-dev@codespeak.net >> >> > http://codespeak.net/mailman/listinfo/py-dev >> >> >> > >> > >> > _______________________________________________ >> > py-dev mailing list >> > py-dev@codespeak.net >> > http://codespeak.net/mailman/listinfo/py-dev >> > >> > > > _______________________________________________ py-dev mailing list py-dev@codespeak.net http://codespeak.net/mailman/listinfo/py-dev