Merge lp:~cjwatson/lazr.uri/tox into lp:lazr.uri

Proposed by Colin Watson
Status: Merged
Merged at revision: 32
Proposed branch: lp:~cjwatson/lazr.uri/tox
Merge into: lp:lazr.uri
Diff against target: 474 lines (+275/-59)
10 files modified
.bzrignore (+9/-8)
HACKING.rst (+1/-6)
MANIFEST.in (+5/-4)
NEWS.rst (+1/-0)
setup.py (+19/-16)
src/lazr/uri/docs/Makefile (+20/-0)
src/lazr/uri/docs/conf.py (+172/-0)
src/lazr/uri/docs/index.rst (+2/-5)
src/lazr/uri/tests/test_docs.py (+29/-20)
tox.ini (+17/-0)
To merge this branch: bzr merge lp:~cjwatson/lazr.uri/tox
Reviewer Review Type Date Requested Status
Ioana Lasc (community) Approve
Review via email: mp+385316@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
Ioana Lasc (ilasc) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2009-03-18 13:11:56 +0000
3+++ .bzrignore 2020-06-08 21:43:07 +0000
4@@ -1,11 +1,12 @@
5+*.egg
6+*.egg-info
7+*.pyc
8+.tox
9 bin
10-develop-eggs
11-.installed.cfg
12-develop-eggs
13-parts
14-*.egg-info
15-tags
16-TAGS
17 build
18-*.egg
19 dist
20+MANIFEST
21+src/lazr/uri/docs/_build
22+TAGS
23+tags
24+__pycache__
25
26=== renamed file 'HACKING.txt' => 'HACKING.rst'
27--- HACKING.txt 2009-03-20 18:09:29 +0000
28+++ HACKING.rst 2020-06-08 21:43:07 +0000
29@@ -13,16 +13,11 @@
30 You should have received a copy of the GNU Lesser General Public License
31 along with lazr.uri. If not, see <http://www.gnu.org/licenses/>.
32
33-This project uses zc.buildout for development.
34-
35 ============
36 Introduction
37 ============
38
39-These are guidelines for hacking on the lazr.uri project. But first,
40-please see the common hacking guidelines at:
41-
42- http://dev.launchpad.net/Hacking
43+To run this project's tests, use `tox <https://tox.readthedocs.io/en/latest/>`.
44
45
46 Getting help
47
48=== modified file 'MANIFEST.in'
49--- MANIFEST.in 2009-06-01 14:34:50 +0000
50+++ MANIFEST.in 2020-06-08 21:43:07 +0000
51@@ -1,4 +1,5 @@
52-include ez_setup.py
53-exclude MANIFEST.in buildout.cfg bootstrap.py .bzrignore
54-global-include *.txt *.zcml
55-prune _bootstrap
56+include COPYING.txt HACKING.rst NEWS.rst
57+recursive-include src *.txt *.rst *.zcml
58+include src/lazr/uri/docs/Makefile
59+prune src/lazr/uri/docs/_build
60+exclude .bzrignore
61
62=== renamed file 'NEWS.txt' => 'NEWS.rst'
63--- NEWS.txt 2019-11-28 00:14:49 +0000
64+++ NEWS.rst 2020-06-08 21:43:07 +0000
65@@ -7,6 +7,7 @@
66
67 - Install version.txt with package_data (Stefano Rivera,
68 https://bugs.launchpad.net/lazr.uri/+bug/918660).
69+- Switch from buildout to tox.
70
71 1.0.3 (2012-01-18)
72 ==================
73
74=== renamed file 'README.txt' => 'README.rst'
75=== removed directory '_bootstrap'
76=== removed file '_bootstrap/COPYRIGHT.txt'
77=== removed file '_bootstrap/LICENSE.txt'
78=== removed file '_bootstrap/bootstrap.py'
79=== removed symlink 'bootstrap.py'
80=== target was '_bootstrap/bootstrap.py'
81=== removed file 'buildout.cfg'
82=== removed file 'ez_setup.py'
83=== modified file 'setup.py'
84--- setup.py 2019-11-28 00:14:49 +0000
85+++ setup.py 2020-06-08 21:43:07 +0000
86@@ -16,22 +16,19 @@
87 # You should have received a copy of the GNU Lesser General Public License
88 # along with lazr.uri. If not, see <http://www.gnu.org/licenses/>.
89
90-import sys
91-try:
92- from setuptools import setup, find_packages
93-except ImportError:
94- import ez_setup
95- ez_setup.use_setuptools()
96- from setuptools import setup, find_packages
97+from setuptools import setup, find_packages
98
99 # generic helpers primarily for the long_description
100 def generate(*docname_or_string):
101+ marker = '.. pypi description ends here'
102 res = []
103 for value in docname_or_string:
104- if value.endswith('.txt'):
105- f = open(value)
106- value = f.read()
107- f.close()
108+ if value.endswith('.rst'):
109+ with open(value) as f:
110+ value = f.read()
111+ idx = value.find(marker)
112+ if idx >= 0:
113+ value = value[:idx]
114 res.append(value)
115 if not value.endswith('\n'):
116 res.append('')
117@@ -54,10 +51,11 @@
118 maintainer='LAZR Developers',
119 maintainer_email='lazr-developers@lists.launchpad.net',
120 download_url= 'https://launchpad.net/lazr.uri/+download',
121- description=open('README.txt').readline().strip(),
122+ description=open('README.rst').readline().strip(),
123 long_description=generate(
124- 'src/lazr/uri/README.txt',
125- 'NEWS.txt'),
126+ 'src/lazr/uri/docs/index.rst',
127+ 'NEWS.rst'),
128+ long_description_content_type='text/x-rst',
129 license='LGPL v3',
130 install_requires=[
131 'setuptools',
132@@ -70,11 +68,16 @@
133 "Operating System :: OS Independent",
134 "Programming Language :: Python",
135 "Programming Language :: Python :: 2",
136+ "Programming Language :: Python :: 2.7",
137 "Programming Language :: Python :: 3",
138+ "Programming Language :: Python :: 3.5",
139+ "Programming Language :: Python :: 3.6",
140+ "Programming Language :: Python :: 3.7",
141+ "Programming Language :: Python :: 3.8",
142 ],
143 extras_require=dict(
144- docs=['Sphinx',
145- 'z3c.recipe.sphinxdoc']
146+ docs=['Sphinx'],
147+ test=['zope.testrunner'],
148 ),
149 test_suite='lazr.uri.tests',
150 )
151
152=== added directory 'src/lazr/uri/docs'
153=== added file 'src/lazr/uri/docs/Makefile'
154--- src/lazr/uri/docs/Makefile 1970-01-01 00:00:00 +0000
155+++ src/lazr/uri/docs/Makefile 2020-06-08 21:43:07 +0000
156@@ -0,0 +1,20 @@
157+# Minimal makefile for Sphinx documentation
158+#
159+
160+# You can set these variables from the command line.
161+SPHINXOPTS =
162+SPHINXBUILD = sphinx-build
163+SPHINXPROJ = lazruri
164+SOURCEDIR = .
165+BUILDDIR = _build
166+
167+# Put it first so that "make" without argument is like "make help".
168+help:
169+ @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
170+
171+.PHONY: help Makefile
172+
173+# Catch-all target: route all unknown targets to Sphinx using the new
174+# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
175+%: Makefile
176+ @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
177\ No newline at end of file
178
179=== added symlink 'src/lazr/uri/docs/NEWS.rst'
180=== target is '../../../../NEWS.rst'
181=== added file 'src/lazr/uri/docs/conf.py'
182--- src/lazr/uri/docs/conf.py 1970-01-01 00:00:00 +0000
183+++ src/lazr/uri/docs/conf.py 2020-06-08 21:43:07 +0000
184@@ -0,0 +1,172 @@
185+#!/usr/bin/env python3
186+# -*- coding: utf-8 -*-
187+#
188+# lazr.uri documentation build configuration file, created by
189+# sphinx-quickstart on Mon Jun 8 21:14:42 2020.
190+#
191+# This file is execfile()d with the current directory set to its
192+# containing dir.
193+#
194+# Note that not all possible configuration values are present in this
195+# autogenerated file.
196+#
197+# All configuration values have a default; values that are commented out
198+# serve to show the default.
199+
200+with open('../version.txt') as version_file:
201+ _version = version_file.read().strip()
202+
203+# If extensions (or modules to document with autodoc) are in another directory,
204+# add these directories to sys.path here. If the directory is relative to the
205+# documentation root, use os.path.abspath to make it absolute, like shown here.
206+#
207+# import os
208+# import sys
209+# sys.path.insert(0, os.path.abspath('.'))
210+
211+
212+# -- General configuration ------------------------------------------------
213+
214+# If your documentation needs a minimal Sphinx version, state it here.
215+#
216+# needs_sphinx = '1.0'
217+
218+# Add any Sphinx extension module names here, as strings. They can be
219+# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
220+# ones.
221+extensions = []
222+
223+# Add any paths that contain templates here, relative to this directory.
224+templates_path = ['_templates']
225+
226+# The suffix(es) of source filenames.
227+# You can specify multiple suffix as a list of string:
228+#
229+# source_suffix = ['.rst', '.md']
230+source_suffix = '.rst'
231+
232+# The master toctree document.
233+master_doc = 'index'
234+
235+# General information about the project.
236+project = 'lazr.uri'
237+copyright = '2006-2020, Canonical Ltd.'
238+author = 'LAZR Developers <lazr-developers@lists.launchpad.net>'
239+
240+# The version info for the project you're documenting, acts as replacement for
241+# |version| and |release|, also used in various other places throughout the
242+# built documents.
243+#
244+# The short X.Y version.
245+version = _version
246+# The full version, including alpha/beta/rc tags.
247+release = _version
248+
249+# The language for content autogenerated by Sphinx. Refer to documentation
250+# for a list of supported languages.
251+#
252+# This is also used if you do content translation via gettext catalogs.
253+# Usually you set "language" from the command line for these cases.
254+language = None
255+
256+# List of patterns, relative to source directory, that match files and
257+# directories to ignore when looking for source files.
258+# This patterns also effect to html_static_path and html_extra_path
259+exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
260+
261+# The name of the Pygments (syntax highlighting) style to use.
262+pygments_style = 'sphinx'
263+
264+# If true, `todo` and `todoList` produce output, else they produce nothing.
265+todo_include_todos = False
266+
267+
268+# -- Options for HTML output ----------------------------------------------
269+
270+# The theme to use for HTML and HTML Help pages. See the documentation for
271+# a list of builtin themes.
272+#
273+html_theme = 'alabaster'
274+
275+# Theme options are theme-specific and customize the look and feel of a theme
276+# further. For a list of options available for each theme, see the
277+# documentation.
278+#
279+# html_theme_options = {}
280+
281+# Add any paths that contain custom static files (such as style sheets) here,
282+# relative to this directory. They are copied after the builtin static files,
283+# so a file named "default.css" will overwrite the builtin "default.css".
284+html_static_path = ['_static']
285+
286+# Custom sidebar templates, must be a dictionary that maps document names
287+# to template names.
288+#
289+# This is required for the alabaster theme
290+# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
291+html_sidebars = {
292+ '**': [
293+ 'relations.html', # needs 'show_related': True theme option to display
294+ 'searchbox.html',
295+ ]
296+}
297+
298+
299+# -- Options for HTMLHelp output ------------------------------------------
300+
301+# Output file base name for HTML help builder.
302+htmlhelp_basename = 'lazruridoc'
303+
304+
305+# -- Options for LaTeX output ---------------------------------------------
306+
307+latex_elements = {
308+ # The paper size ('letterpaper' or 'a4paper').
309+ #
310+ # 'papersize': 'letterpaper',
311+
312+ # The font size ('10pt', '11pt' or '12pt').
313+ #
314+ # 'pointsize': '10pt',
315+
316+ # Additional stuff for the LaTeX preamble.
317+ #
318+ # 'preamble': '',
319+
320+ # Latex figure (float) alignment
321+ #
322+ # 'figure_align': 'htbp',
323+}
324+
325+# Grouping the document tree into LaTeX files. List of tuples
326+# (source start file, target name, title,
327+# author, documentclass [howto, manual, or own class]).
328+latex_documents = [
329+ (master_doc, 'lazruri.tex', 'lazr.uri Documentation',
330+ 'LAZR Developers', 'manual'),
331+]
332+
333+
334+# -- Options for manual page output ---------------------------------------
335+
336+# One entry per manual page. List of tuples
337+# (source start file, name, description, authors, manual section).
338+man_pages = [
339+ (master_doc, 'lazruri', 'lazr.uri Documentation',
340+ [author], 1)
341+]
342+
343+
344+# -- Options for Texinfo output -------------------------------------------
345+
346+# Grouping the document tree into Texinfo files. List of tuples
347+# (source start file, target name, title, author,
348+# dir menu entry, description, category)
349+texinfo_documents = [
350+ (master_doc, 'lazruri', 'lazr.uri Documentation',
351+ author, 'lazruri', 'One line description of project.',
352+ 'Miscellaneous'),
353+]
354+
355+
356+
357
358=== renamed file 'src/lazr/uri/README.txt' => 'src/lazr/uri/docs/index.rst'
359--- src/lazr/uri/README.txt 2012-01-18 10:52:32 +0000
360+++ src/lazr/uri/docs/index.rst 2020-06-08 21:43:07 +0000
361@@ -138,12 +138,9 @@
362 http://bazaar.launchpad.net/~name12/firefox/foo
363 http://somewhere.in/time?track=[02]#wasted-years
364
365-===============
366-Other Documents
367-===============
368+.. pypi description ends here
369
370 .. toctree::
371 :glob:
372
373- *
374- docs/*
375+ NEWS
376
377=== modified file 'src/lazr/uri/tests/test_docs.py'
378--- src/lazr/uri/tests/test_docs.py 2012-01-18 10:52:32 +0000
379+++ src/lazr/uri/tests/test_docs.py 2020-06-08 21:43:07 +0000
380@@ -13,20 +13,27 @@
381 #
382 # You should have received a copy of the GNU Lesser General Public License
383 # along with lazr.uri. If not, see <http://www.gnu.org/licenses/>.
384-"Test harness for doctests."
385+
386+"""Test harness for doctests."""
387
388 from __future__ import print_function
389
390 __metaclass__ = type
391 __all__ = [
392- 'additional_tests',
393+ 'load_tests',
394 ]
395
396 import atexit
397 import doctest
398 import os
399-import pkg_resources
400-import unittest
401+
402+from pkg_resources import (
403+ cleanup_resources,
404+ resource_exists,
405+ resource_filename,
406+ resource_listdir,
407+ )
408+
409
410 DOCTEST_FLAGS = (
411 doctest.ELLIPSIS |
412@@ -34,22 +41,24 @@
413 doctest.REPORT_NDIFF)
414
415
416-def additional_tests():
417- "Run the doc tests (README.txt and docs/*, if any exist)"
418- doctest_files = [
419- os.path.abspath(
420- pkg_resources.resource_filename('lazr.uri', 'README.txt'))]
421- if pkg_resources.resource_exists('lazr.uri', 'docs'):
422- for name in pkg_resources.resource_listdir('lazr.uri', 'docs'):
423- if name.endswith('.txt'):
424+def find_doctests(suffix):
425+ """Find doctests matching a certain suffix."""
426+ doctest_files = []
427+ # Match doctests against the suffix.
428+ if resource_exists('lazr.uri', 'docs'):
429+ for name in resource_listdir('lazr.uri', 'docs'):
430+ if name.endswith(suffix):
431 doctest_files.append(
432 os.path.abspath(
433- pkg_resources.resource_filename(
434- 'lazr.uri', 'docs/%s' % name)))
435- kwargs = dict(
436+ resource_filename('lazr.uri', 'docs/%s' % name)))
437+ return doctest_files
438+
439+
440+def load_tests(loader, tests, pattern):
441+ """Load all the doctests."""
442+ atexit.register(cleanup_resources)
443+ tests.addTest(doctest.DocFileSuite(
444+ *find_doctests('.rst'),
445 module_relative=False, optionflags=DOCTEST_FLAGS,
446- globs={"print_function": print_function},
447- )
448- atexit.register(pkg_resources.cleanup_resources)
449- return unittest.TestSuite((
450- doctest.DocFileSuite(*doctest_files, **kwargs)))
451+ globs={"print_function": print_function}))
452+ return tests
453
454=== added file 'tox.ini'
455--- tox.ini 1970-01-01 00:00:00 +0000
456+++ tox.ini 2020-06-08 21:43:07 +0000
457@@ -0,0 +1,17 @@
458+[tox]
459+envlist =
460+ py27,py35,py36,py37,py38,docs
461+
462+[testenv]
463+commands =
464+ zope-testrunner --test-path src --tests-pattern ^tests {posargs}
465+deps =
466+ .[test]
467+
468+[testenv:docs]
469+basepython =
470+ python3.8
471+commands =
472+ sphinx-build -b html -d src/lazr/uri/docs/_build/doctrees src/lazr/uri/docs src/lazr/uri/docs/_build/html
473+deps =
474+ .[docs]

Subscribers

People subscribed via source and target branches