[Checkins] SVN: z3c.recipe.compattest/trunk/ allow building the list of packages to test from a buildout-section, to make it easy to test against a KGS.
Wolfgang Schnerring
wosc at wosc.de
Fri Aug 7 05:27:43 EDT 2009
Log message for revision 102556:
allow building the list of packages to test from a buildout-section, to make it easy to test against a KGS.
Changed:
U z3c.recipe.compattest/trunk/CHANGES.txt
U z3c.recipe.compattest/trunk/buildout.cfg
U z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/README.txt
U z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/recipe.py
-=-
Modified: z3c.recipe.compattest/trunk/CHANGES.txt
===================================================================
--- z3c.recipe.compattest/trunk/CHANGES.txt 2009-08-07 08:05:36 UTC (rev 102555)
+++ z3c.recipe.compattest/trunk/CHANGES.txt 2009-08-07 09:27:43 UTC (rev 102556)
@@ -5,6 +5,10 @@
0.6 (unreleased)
================
+- Restructured the way we construct our list of packages to test:
+ We no longer filter a list we retrieved from SVN with includes/excludes,
+ but use an explicit list that can be populated from a buildout section,
+ e. g. [versions]. Thus, we can now easily test against a KGS.
- Always enable all extras of packages under test.
0.5 (2009-01-29)
Modified: z3c.recipe.compattest/trunk/buildout.cfg
===================================================================
--- z3c.recipe.compattest/trunk/buildout.cfg 2009-08-07 08:05:36 UTC (rev 102555)
+++ z3c.recipe.compattest/trunk/buildout.cfg 2009-08-07 09:27:43 UTC (rev 102556)
@@ -13,5 +13,8 @@
[compattest-trunk]
recipe = z3c.recipe.compattest
-include = zope.dottedname
-use_svn = true
+include = [example-versions]
+svn_url = svn://svn.zope.org/repos/main/
+
+[example-versions]
+zope.dottedname =
Modified: z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/README.txt
===================================================================
--- z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/README.txt 2009-08-07 08:05:36 UTC (rev 102555)
+++ z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/README.txt 2009-08-07 09:27:43 UTC (rev 102556)
@@ -13,16 +13,17 @@
Add a part to your buildout.cfg that uses this recipe.
No further configuration is required, but you can set the following options:
-- ``svn_url``: SVN repository to search for packages,
-- ``include``: only packages matching a regex in this list (one regex per line)
- will be included (default:``^zope\..*``, ``^grokcore\..*``),
-- ``exclude``: packages matching any regex in this list will be excluded, even if
- they match ``include`` (default: a list of deprectated/obsolete
- ``zope.*`` packages, see ``z3c.recipe.compattest.recipe`` for
- details),
-- ``script``: the name of the runner script (default: test-compat).
+- ``include``: list of packages to include (one package per line)
+ If an entry has the form ``[section]``, all keys of that
+ buildout section are included.
+ (default: the version-section of the buildout (``${buildout:versions}``)
+ if one is defined)
+- ``exclude``: packages matching any regex in this list will be excluded
+ (default: empty)
+- ``script``: the name of the runner script (default: test-<partname>)
-- ``use_svn``: use SVN checkouts instead of releases (see below)
+- ``svn_url``: SVN repository to search for packages instead of using releases
+ (see below)
- ``svn_directory``: directory to place checkouts in (default: parts/<partname>)
>>> cd(sample_buildout)
@@ -35,10 +36,6 @@
... include = z3c.recipe.compattest
... """)
-For this test, we only include a single package. With the default
-include/exclude values, about 150 packages will be included, so be aware
-that running the buildout will take some time.
-
>>> print system(buildout)
Couldn't...Installing compattest...
@@ -68,7 +65,7 @@
Using SVN checkouts
===================
-When you set ``use_svn`` to true, the test runners will not refer to released
+When you set an ``svn_url``, the test runners will not refer to released
eggs, but rather use development-egg links to SVN checkouts of the trunks of
each package (the checkouts are placed in ``svn_directory``).
@@ -83,12 +80,17 @@
>>> write('buildout.cfg', """
... [buildout]
... parts = compattest-trunk
+... versions = versions
...
+... [versions]
+... # we don't care about the version numbers, we just extract
+... # which package names to include from here
+... z3c.recipe.compattest =
+... zope.dottedname =
+...
... [compattest-trunk]
... recipe = z3c.recipe.compattest
-... include = zope.dottedname
-... z3c.recipe.compattest
-... use_svn = true
+... svn_url = svn://svn.zope.org/repos/main/
... """)
>>> ignore = system(buildout)
Modified: z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/recipe.py
===================================================================
--- z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/recipe.py 2009-08-07 08:05:36 UTC (rev 102555)
+++ z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/recipe.py 2009-08-07 09:27:43 UTC (rev 102556)
@@ -8,38 +8,6 @@
import zc.recipe.testrunner
-INCLUDE = ['^zope\..*', '^grokcore\..*']
-
-EXCLUDE = [
- 'zope.agxassociation',
- 'zope.app.boston',
- 'zope.app.css',
- 'zope.app.demo',
- 'zope.app.fssync',
- 'zope.app.recorder',
- 'zope.app.schemacontent',
- 'zope.app.sqlexpr',
- 'zope.app.styleguide',
- 'zope.app.tests',
- 'zope.app.versioncontrol',
- 'zope.app.zopetop',
- 'zope.bobo',
- 'zope.browserzcml2',
- 'zope.fssync',
- 'zope.generic',
- 'zope.importtool',
- 'zope.kgs',
- 'zope.pytz',
- 'zope.release',
- 'zope.timestamp',
- 'zope.tutorial',
- 'zope.ucol',
- 'zope.weakset',
- 'zope.webdev',
- 'zope.xmlpickle',
- ]
-
-
def string2list(string, default):
result = string and string.split('\n') or default
return [item.strip() for item in result]
@@ -55,24 +23,25 @@
if not 'max_jobs' in options:
options['max_jobs'] = '1'
- self.svn_url = self.options.get('svn_url',
- 'svn://svn.zope.org/repos/main/')
- if self.svn_url[-1] != '/':
- self.svn_url += '/'
- self.exclude = (
- string2list(self.options.get('exclude', ''), []) + EXCLUDE)
- self.include = string2list(self.options.get('include', ''), INCLUDE)
+ self.exclude = string2list(self.options.get('exclude', ''), [])
+ self.include = string2list(self.options.get('include', ''), [])
+ versions_section = self.buildout['buildout'].get('versions')
+ if versions_section:
+ self.include.append('[%s]' % versions_section)
+ self._expand_includes()
+ self.wanted_packages = self._wanted_packages()
self.script = self.options.get('script', 'test-%s' % self.name)
- self.wanted_packages = self._wanted_packages()
- self.use_svn = self.options.get('use_svn', False)
+ self.svn_url = self.options.get('svn_url', None)
+ if self.svn_url and self.svn_url[-1] != '/':
+ self.svn_url += '/'
self.svn_directory = self.options.get(
'svn_directory', os.path.join(
self.buildout['buildout']['parts-directory'], self.name))
def install(self):
- if self.use_svn:
+ if self.svn_url:
if not os.path.exists(self.svn_directory):
os.mkdir(self.svn_directory)
return self.update()
@@ -80,14 +49,14 @@
def update(self):
installed = []
- if self.use_svn:
+ if self.svn_url:
zc.buildout.easy_install.distribution_cache = {}
self._install_checkouts()
installed.extend(self._install_testrunners())
installed.extend(self._install_run_script())
- if self.use_svn:
+ if self.svn_url:
self._remove_develop_eggs()
zc.buildout.easy_install.distribution_cache = {}
@@ -101,7 +70,7 @@
package_ = ws.find(pkg_resources.Requirement.parse(package))
extras = '[' + ','.join(package_.extras) + ']'
except zc.buildout.easy_install.MissingDistribution, e:
- if e.data[0].project_name == package and not self.use_svn:
+ if e.data[0].project_name == package and not self.svn_url:
# This package has a project in subversion but no
# release (yet). We'll ignore it for now.
print "No release found for %s. Ignoring." % package
@@ -127,22 +96,21 @@
bindir, arguments='%s, %s' % (self.options['max_jobs'],
', '.join(runners)))
+ def _expand_includes(self):
+ """expands entries of the form [section] to the keys in that section"""
+ sections = [x for x in self.include if x.startswith('[')]
+ for section in sections:
+ self.include.remove(section)
+ for package in self.buildout[section[1:-1]]:
+ self.include.append(package)
+
def _wanted_packages(self):
- projects = []
- svn_list, _ = popen2.popen2("svn ls %s" % self.svn_url)
- for project in svn_list:
- project = project[:-2]
- include = False
- for regex in self.include:
- if re.compile(regex).search(project):
- include = True
- break
+ projects = self.include
+ for project in projects:
for regex in self.exclude:
if re.compile(regex).search(project):
- include = False
+ projects.remove(project)
break
- if include:
- projects.append(project)
return projects
def _working_set(self, package):
More information about the Checkins
mailing list