[TIP] coverage.py and pyramid web framework?

Tres Seaver tseaver at palladion.com
Fri Aug 24 07:35:22 PDT 2012


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 08/23/2012 08:34 PM, Ben Cohen wrote:

> The most obvious shared feature of the functions/methods that report
> no coverage is the use of a venusian callback method decorator --
> this decorator marks functions/methods with declarative attributes, 
> subsequently modules are scanned for methods with those attributes
> and then ingested by the pyramid web framework's web-publishing
> machinery.
> 
> Is there some magic happening within the pyramid framework that
> causes coverage to fail to register when these methods are called?  Is
> anybody using coverage and pyramid together without issue …?  I didn't
> expect so fundamental an issue with the two as the pyramid
> documentation has a chapter describing the use of coverage in unit
> tests …

Pyramid itself runs tests with the coverage package without issues (run
via 'setup.py nosetests --with-xunit --with-xcoverage' -- see the 'cover'
environment in its tox.ini).  We use it routinely for apps built on
Pyramid as well.  The venusian decorator does not do anything to
interfere with coverage:  the attributes it adds to the decorated
function are used to populate Pyramid's registry during the later "scan"
phase.



Tres.
- -- 
===================================================================
Tres Seaver          +1 540-429-0999          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAlA3kSUACgkQ+gerLs4ltQ5IyACeNXEI6JtfJI+AnjqNAY65HkUr
XI4AoKTP/GXlRnI6FQJb1kiAi/6wuSNR
=Llm4
-----END PGP SIGNATURE-----




More information about the testing-in-python mailing list