z3c.recipe.compattest

Buildout recipe to create test runners for testing compatibility with other packages
Download

z3c.recipe.compattest Ranking & Summary

Advertisement

  • Rating:
  • License:
  • ZPL
  • Publisher Name:
  • Grok Contributors
  • Publisher web site:
  • http://zope.org

z3c.recipe.compattest Tags


z3c.recipe.compattest Description

Buildout recipe to create test runners for testing compatibility with other packages z3c.recipe.compattest is a buildout recipe generates a list of packages to test and a test runner that runs each package's tests (isolated from any other tests). This is useful to check that the changes made while developing a package do not break any packages that are using this package.UsageAdd a part to your buildout.cfg that uses this recipe. No further configuration is required, but you can set the following options: * include: list of packages to include (whitespace-separated) (default: empty) * include-dependencies: list of packages to include including their direct dependencies. (default: empty) * exclude: packages matching any regex in this list will be excluded (default: empty) * script: the name of the runner script (defaults to the part name)>>> cd(sample_buildout)>>> write('buildout.cfg', """... ... parts = compattest...... ... recipe = z3c.recipe.compattest... include = z3c.recipe.compattest... """)>>> 'Installing compattest' in system(buildout)TrueDetailsThe recipe generates a test runner for each package, as well as a global runner script (called test-compat by default) that will run all of them:>>> ls('bin')- buildout- compattest- compattest-z3c.recipe.compattest>>> cat('bin', 'compattest')#!...python......main(...compattest-z3c.recipe.compattest...We take care about installing the test dependencies for the packages (from their extras_require). Do demonstrate this, we declared a (superfluous) test dependency on zope.dottedname, which is picked up:>>> cat('parts', 'compattest-z3c.recipe.compattest', 'site-packages', 'site.py')"""Append module ......zope.dottedname...If we use include-dependencies instead of just include, our direct dependencies are also picked up, for instance zc.buildout:>>> write('buildout.cfg', """... ... parts = compattest...... ... recipe = z3c.recipe.compattest... include-dependencies = z3c.recipe.compattest... """)>>> print 'start', system(buildout)start ...Generated script '/sample-buildout/bin/compattest-zc.buildout'....Generated script '/sample-buildout/bin/compattest'.All our direct dependencies have a test script now:>>> ls('bin')- buildout- compattest- compattest-z3c.recipe.compattest- compattest-zc.buildout- compattest-zc.recipe.testrunnerAnd if you want to exclude one of the automatically included dependencies, use the exclude option:>>> write('buildout.cfg', """... ... parts = compattest...... ... recipe = z3c.recipe.compattest... include-dependencies = z3c.recipe.compattest... exclude = zc.buildout... """)>>> print 'start', system(buildout)start ...Generated script '/sample-buildout/bin/compattest'.bin/compattest-zc.buildout is now missing:>>> ls('bin')- buildout- compattest- compattest-z3c.recipe.compattest- compattest-zc.recipe.testrunnerPassing options to the test runnersIf you want to use custom options in the generated test runners, you can specify them in the part options, prefixed by runner-. That is, if you want to pass the --foo option by default to all generated test runners, you can set runner-defaults = in your part:>>> write('buildout.cfg', """... ... parts = compattest...... ... recipe = z3c.recipe.compattest... include = z3c.recipe.compattest... runner-defaults = ... """)>>> ignore = system(buildout)>>> cat('bin', 'compattest-z3c.recipe.compattest')#!...python......run(......Every options prefixed by runner- will be automatically passed to the generated test runners.Passing Extra paths to the test runnersIf you want to add some paths to the generated test runners, you can do it with the extra-paths option in the part. This might be interesting if you want to test packages that depends on zope2 < 2.12:>>> write('buildout.cfg', """... ... parts = compattest...... ... recipe = z3c.recipe.compattest... include = z3c.recipe.compattest... extra-paths = zope2location/lib/python... """)>>> ignore = system(buildout)>>> cat('parts', 'compattest-z3c.recipe.compattest', 'site-packages', 'site.py')"""Append module ......zope2location/lib/python... Requirements: · Python What's New in This Release: · Depend on and use the new features of the zc.buildout 1.5 line. At the same time support for zc.buildout


z3c.recipe.compattest Related Software