Merge lp:~cjwatson/rabbitfixture/tox into lp:rabbitfixture

Proposed by Colin Watson
Status: Merged
Merged at revision: 47
Proposed branch: lp:~cjwatson/rabbitfixture/tox
Merge into: lp:rabbitfixture
Diff against target: 355 lines (+21/-283)
6 files modified
.bzrignore (+1/-6)
Makefile (+9/-39)
README (+2/-6)
bootstrap.py (+0/-210)
buildout.cfg (+0/-22)
tox.ini (+9/-0)
To merge this branch: bzr merge lp:~cjwatson/rabbitfixture/tox
Reviewer Review Type Date Requested Status
William Grant code Approve
Review via email: mp+371587@code.launchpad.net

Commit message

Add tox testing support and drop buildout.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2011-07-05 20:01:36 +0000
3+++ .bzrignore 2019-08-21 14:24:21 +0000
4@@ -1,11 +1,6 @@
5 *.egg-info
6-./.installed.cfg
7+./.tox
8 ./TAGS
9-./bin
10 ./build
11-./develop-eggs
12 ./dist
13-./download-cache/dist
14-./eggs
15-./parts
16 ./tags
17
18=== modified file 'Makefile'
19--- Makefile 2011-06-28 17:21:03 +0000
20+++ Makefile 2019-08-21 14:24:21 +0000
21@@ -1,48 +1,18 @@
22-# Copyright 2005-2011 Canonical Ltd. This software is licensed under the
23+# Copyright 2005-2019 Canonical Ltd. This software is licensed under the
24 # GNU Affero General Public License version 3 (see the file LICENSE).
25
26 PYTHON = python
27-PY = $(PWD)/bin/py
28-
29-BUILDOUT_CFG = buildout.cfg
30-
31-# Do not add bin/buildout to this list. It is impossible to get
32-# buildout to tell us all the files it would build, since each egg's
33-# setup.py doesn't tell us that information.
34-#
35-# NB: It's important BUILDOUT_BIN only mentions things genuinely
36-# produced by buildout.
37-BUILDOUT_BIN = $(PY) bin/tags bin/test
38
39
40 default: check
41
42
43-download-cache:
44- mkdir download-cache
45-
46-
47-bin/buildout: download-cache
48- $(PYTHON) bootstrap.py
49- touch --no-create $@
50-
51-
52-$(PY): bin/buildout $(BUILDOUT_CFG) setup.py
53- PYTHONPATH=. ./bin/buildout -c $(BUILDOUT_CFG)
54-
55-
56-$(subst $(PY),,$(BUILDOUT_BIN)): $(PY)
57-
58-
59-build: $(BUILDOUT_BIN)
60-
61-
62 dist: setup.py
63- $(PY) setup.py egg_info -r sdist
64-
65-
66-check: bin/test
67- ./bin/test -vv
68-
69-
70-.PHONY: build check default dist
71+ $(PYTHON) setup.py sdist
72+
73+
74+check:
75+ tox
76+
77+
78+.PHONY: check default dist
79
80=== modified file 'README'
81--- README 2011-06-28 17:21:58 +0000
82+++ README 2019-08-21 14:24:21 +0000
83@@ -1,13 +1,9 @@
84 A RabbitMQ fixture.
85
86
87-Building
88---------
89-
90- $ make build
91-
92-
93 Testing
94 -------
95
96+The rabbitmq-server package must be installed.
97+
98 $ make check
99
100=== removed file 'bootstrap.py'
101--- bootstrap.py 2016-05-29 14:05:35 +0000
102+++ bootstrap.py 1970-01-01 00:00:00 +0000
103@@ -1,210 +0,0 @@
104-##############################################################################
105-#
106-# Copyright (c) 2006 Zope Foundation and Contributors.
107-# All Rights Reserved.
108-#
109-# This software is subject to the provisions of the Zope Public License,
110-# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
111-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
112-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
113-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
114-# FOR A PARTICULAR PURPOSE.
115-#
116-##############################################################################
117-"""Bootstrap a buildout-based project
118-
119-Simply run this script in a directory containing a buildout.cfg.
120-The script accepts buildout command-line options, so you can
121-use the -c option to specify an alternate configuration file.
122-"""
123-
124-import os
125-import shutil
126-import sys
127-import tempfile
128-
129-from optparse import OptionParser
130-
131-__version__ = '2015-07-01'
132-# See zc.buildout's changelog if this version is up to date.
133-
134-tmpeggs = tempfile.mkdtemp(prefix='bootstrap-')
135-
136-usage = '''\
137-[DESIRED PYTHON FOR BUILDOUT] bootstrap.py [options]
138-
139-Bootstraps a buildout-based project.
140-
141-Simply run this script in a directory containing a buildout.cfg, using the
142-Python that you want bin/buildout to use.
143-
144-Note that by using --find-links to point to local resources, you can keep
145-this script from going over the network.
146-'''
147-
148-parser = OptionParser(usage=usage)
149-parser.add_option("--version",
150- action="store_true", default=False,
151- help=("Return bootstrap.py version."))
152-parser.add_option("-t", "--accept-buildout-test-releases",
153- dest='accept_buildout_test_releases',
154- action="store_true", default=False,
155- help=("Normally, if you do not specify a --version, the "
156- "bootstrap script and buildout gets the newest "
157- "*final* versions of zc.buildout and its recipes and "
158- "extensions for you. If you use this flag, "
159- "bootstrap and buildout will get the newest releases "
160- "even if they are alphas or betas."))
161-parser.add_option("-c", "--config-file",
162- help=("Specify the path to the buildout configuration "
163- "file to be used."))
164-parser.add_option("-f", "--find-links",
165- help=("Specify a URL to search for buildout releases"))
166-parser.add_option("--allow-site-packages",
167- action="store_true", default=False,
168- help=("Let bootstrap.py use existing site packages"))
169-parser.add_option("--buildout-version",
170- help="Use a specific zc.buildout version")
171-parser.add_option("--setuptools-version",
172- help="Use a specific setuptools version")
173-parser.add_option("--setuptools-to-dir",
174- help=("Allow for re-use of existing directory of "
175- "setuptools versions"))
176-
177-options, args = parser.parse_args()
178-if options.version:
179- print("bootstrap.py version %s" % __version__)
180- sys.exit(0)
181-
182-
183-######################################################################
184-# load/install setuptools
185-
186-try:
187- from urllib.request import urlopen
188-except ImportError:
189- from urllib2 import urlopen
190-
191-ez = {}
192-if os.path.exists('ez_setup.py'):
193- exec(open('ez_setup.py').read(), ez)
194-else:
195- exec(urlopen('https://bootstrap.pypa.io/ez_setup.py').read(), ez)
196-
197-if not options.allow_site_packages:
198- # ez_setup imports site, which adds site packages
199- # this will remove them from the path to ensure that incompatible versions
200- # of setuptools are not in the path
201- import site
202- # inside a virtualenv, there is no 'getsitepackages'.
203- # We can't remove these reliably
204- if hasattr(site, 'getsitepackages'):
205- for sitepackage_path in site.getsitepackages():
206- # Strip all site-packages directories from sys.path that
207- # are not sys.prefix; this is because on Windows
208- # sys.prefix is a site-package directory.
209- if sitepackage_path != sys.prefix:
210- sys.path[:] = [x for x in sys.path
211- if sitepackage_path not in x]
212-
213-setup_args = dict(to_dir=tmpeggs, download_delay=0)
214-
215-if options.setuptools_version is not None:
216- setup_args['version'] = options.setuptools_version
217-if options.setuptools_to_dir is not None:
218- setup_args['to_dir'] = options.setuptools_to_dir
219-
220-ez['use_setuptools'](**setup_args)
221-import setuptools
222-import pkg_resources
223-
224-# This does not (always?) update the default working set. We will
225-# do it.
226-for path in sys.path:
227- if path not in pkg_resources.working_set.entries:
228- pkg_resources.working_set.add_entry(path)
229-
230-######################################################################
231-# Install buildout
232-
233-ws = pkg_resources.working_set
234-
235-setuptools_path = ws.find(
236- pkg_resources.Requirement.parse('setuptools')).location
237-
238-# Fix sys.path here as easy_install.pth added before PYTHONPATH
239-cmd = [sys.executable, '-c',
240- 'import sys; sys.path[0:0] = [%r]; ' % setuptools_path +
241- 'from setuptools.command.easy_install import main; main()',
242- '-mZqNxd', tmpeggs]
243-
244-find_links = os.environ.get(
245- 'bootstrap-testing-find-links',
246- options.find_links or
247- ('http://downloads.buildout.org/'
248- if options.accept_buildout_test_releases else None)
249- )
250-if find_links:
251- cmd.extend(['-f', find_links])
252-
253-requirement = 'zc.buildout'
254-version = options.buildout_version
255-if version is None and not options.accept_buildout_test_releases:
256- # Figure out the most recent final version of zc.buildout.
257- import setuptools.package_index
258- _final_parts = '*final-', '*final'
259-
260- def _final_version(parsed_version):
261- try:
262- return not parsed_version.is_prerelease
263- except AttributeError:
264- # Older setuptools
265- for part in parsed_version:
266- if (part[:1] == '*') and (part not in _final_parts):
267- return False
268- return True
269-
270- index = setuptools.package_index.PackageIndex(
271- search_path=[setuptools_path])
272- if find_links:
273- index.add_find_links((find_links,))
274- req = pkg_resources.Requirement.parse(requirement)
275- if index.obtain(req) is not None:
276- best = []
277- bestv = None
278- for dist in index[req.project_name]:
279- distv = dist.parsed_version
280- if _final_version(distv):
281- if bestv is None or distv > bestv:
282- best = [dist]
283- bestv = distv
284- elif distv == bestv:
285- best.append(dist)
286- if best:
287- best.sort()
288- version = best[-1].version
289-if version:
290- requirement = '=='.join((requirement, version))
291-cmd.append(requirement)
292-
293-import subprocess
294-if subprocess.call(cmd) != 0:
295- raise Exception(
296- "Failed to execute command:\n%s" % repr(cmd)[1:-1])
297-
298-######################################################################
299-# Import and run buildout
300-
301-ws.add_entry(tmpeggs)
302-ws.require(requirement)
303-import zc.buildout.buildout
304-
305-if not [a for a in args if '=' not in a]:
306- args.append('bootstrap')
307-
308-# if -c was provided, we push it back into args for buildout' main function
309-if options.config_file is not None:
310- args[0:0] = ['-c', options.config_file]
311-
312-zc.buildout.buildout.main(args)
313-shutil.rmtree(tmpeggs)
314
315=== removed file 'buildout.cfg'
316--- buildout.cfg 2016-05-29 14:05:35 +0000
317+++ buildout.cfg 1970-01-01 00:00:00 +0000
318@@ -1,22 +0,0 @@
319-[buildout]
320-parts =
321- interpreter
322- test
323-use-dependency-links = false
324-unzip = true
325-include-site-packages = false
326-exec-sitecustomize = true
327-develop = .
328-download-cache = download-cache
329-eggs-directory = eggs
330-
331-[test]
332-recipe = zc.recipe.testrunner
333-eggs = rabbitfixture
334-defaults = '--tests-pattern ^tests --exit-with-status'.split()
335-
336-[interpreter]
337-recipe = zc.recipe.egg:scripts
338-dependent-scripts = true
339-interpreter = py
340-eggs = rabbitfixture
341
342=== removed directory 'download-cache'
343=== added file 'tox.ini'
344--- tox.ini 1970-01-01 00:00:00 +0000
345+++ tox.ini 2019-08-21 14:24:21 +0000
346@@ -0,0 +1,9 @@
347+[tox]
348+envlist = py27,py34,py35,py36,py37
349+
350+[testenv]
351+commands =
352+ zope-testrunner --test-path . --tests-pattern ^tests {posargs}
353+deps =
354+ .[test]
355+ zope.testrunner

Subscribers

People subscribed via source and target branches

to all changes: