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