Merge ~cjwatson/lazr.config:rhinectomy into lazr.config:main
- Git
- lp:~cjwatson/lazr.config
- rhinectomy
- Merge into main
Status: | Merged |
---|---|
Merged at revision: | e4b2f8cfb6bcbf6e5475b8a9a1adfa8541631af6 |
Proposed branch: | ~cjwatson/lazr.config:rhinectomy |
Merge into: | lazr.config:main |
Diff against target: |
236 lines (+96/-32) 5 files modified
.gitignore (+1/-0) NEWS.rst (+1/-0) dev/null (+0/-27) src/lazr/config/tests/test_docs.py (+67/-0) tox.ini (+27/-5) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jürgen Gmach | Approve | ||
Review via email:
|
Commit message
Test using zope.testrunner rather than nose
Description of the change
`nose` is unmaintained and doesn't work with Python 3.10. There's `nose2`, but using `zope.testrunner` brings this more into line with other lazr.* projects.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Jürgen Gmach (jugmac00) wrote : | # |
$ tox -e coverage
GLOB sdist-make: /home/jugmac00/
coverage inst-nodeps: /home/jugmac00/
coverage installed: coverage=
coverage run-test-pre: PYTHONHASHSEED=
coverage run-test: commands[0] | python --version
Python 3.8.10
coverage run-test: commands[1] | coverage erase
coverage run-test: commands[2] | coverage run -m zope.testrunner --test-path src --tests-pattern '^tests'
Running zope.testrunner
Set up zope.testrunner
Ran 24 tests with 0 failures, 0 errors and 0 skipped in 0.049 seconds.
Tearing down left over layers:
Tear down zope.testrunner
coverage run-test: commands[3] | coverage html
Wrote HTML report to htmlcov/index.html
coverage run-test: commands[4] | coverage report -m --fail-under=97
Name Stmts Miss Cover Missing
-------
.tox/coverage/
.tox/coverage/
.tox/coverage/
.tox/coverage/
.tox/coverage/
.tox/coverage/
.tox/coverage/
.tox/coverage/
.tox/coverage/
-------
TOTAL 644 23 96%
Coverage failure: total of 96 is less than fail-under=97
ERROR: InvocationError for command /home/jugmac00/
_______
ERROR: coverage: commands failed
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Colin Watson (cjwatson) wrote : | # |
The difference is that src/lazr/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Jürgen Gmach (jugmac00) wrote : | # |
Thanks! Not going down this rabbit hole :-)
Preview Diff
1 | diff --git a/.coverage b/.coverage | |||
2 | 0 | deleted file mode 100644 | 0 | deleted file mode 100644 |
3 | index 33846df..0000000 | |||
4 | 1 | Binary files a/.coverage and /dev/null differ | 1 | Binary files a/.coverage and /dev/null differ |
5 | diff --git a/.gitignore b/.gitignore | |||
6 | index cff4a80..2964eac 100644 | |||
7 | --- a/.gitignore | |||
8 | +++ b/.gitignore | |||
9 | @@ -12,4 +12,5 @@ dist | |||
10 | 12 | .tox | 12 | .tox |
11 | 13 | __pycache__ | 13 | __pycache__ |
12 | 14 | .coverage | 14 | .coverage |
13 | 15 | htmlcov | ||
14 | 15 | src/lazr/config/docs/_build | 16 | src/lazr/config/docs/_build |
15 | diff --git a/NEWS.rst b/NEWS.rst | |||
16 | index 58e26ba..d7a814b 100644 | |||
17 | --- a/NEWS.rst | |||
18 | +++ b/NEWS.rst | |||
19 | @@ -7,6 +7,7 @@ NEWS for lazr.config | |||
20 | 7 | - Add basic pre-commit configuration. | 7 | - Add basic pre-commit configuration. |
21 | 8 | - Publish Documentation on Read the Docs. | 8 | - Publish Documentation on Read the Docs. |
22 | 9 | - Apply inclusive naming via the woke pre-commit hook. | 9 | - Apply inclusive naming via the woke pre-commit hook. |
23 | 10 | - Test using ``zope.testrunner`` rather than ``nose``. | ||
24 | 10 | 11 | ||
25 | 11 | 2.2.3 (2021-01-26) | 12 | 2.2.3 (2021-01-26) |
26 | 12 | ================== | 13 | ================== |
27 | diff --git a/setup.cfg b/setup.cfg | |||
28 | 13 | deleted file mode 100644 | 14 | deleted file mode 100644 |
29 | index c7266bb..0000000 | |||
30 | --- a/setup.cfg | |||
31 | +++ /dev/null | |||
32 | @@ -1,9 +0,0 @@ | |||
33 | 1 | [nosetests] | ||
34 | 2 | verbosity=3 | ||
35 | 3 | with-coverage=1 | ||
36 | 4 | with-doctest=1 | ||
37 | 5 | doctest-extension=.rst | ||
38 | 6 | doctest-options=+ELLIPSIS,+NORMALIZE_WHITESPACE,+REPORT_NDIFF | ||
39 | 7 | doctest-fixtures=_fixture | ||
40 | 8 | cover-package=lazr.config | ||
41 | 9 | pdb=1 | ||
42 | diff --git a/src/lazr/config/docs/fixture.py b/src/lazr/config/docs/fixture.py | |||
43 | 10 | deleted file mode 100644 | 0 | deleted file mode 100644 |
44 | index c1e3c1e..0000000 | |||
45 | --- a/src/lazr/config/docs/fixture.py | |||
46 | +++ /dev/null | |||
47 | @@ -1,34 +0,0 @@ | |||
48 | 1 | # Copyright 2009-2015 Canonical Ltd. All rights reserved. | ||
49 | 2 | # | ||
50 | 3 | # This file is part of lazr.smtptest | ||
51 | 4 | # | ||
52 | 5 | # lazr.smtptest is free software: you can redistribute it and/or modify it | ||
53 | 6 | # under the terms of the GNU Lesser General Public License as published by | ||
54 | 7 | # the Free Software Foundation, version 3 of the License. | ||
55 | 8 | # | ||
56 | 9 | # lazr.smtptest is distributed in the hope that it will be useful, but WITHOUT | ||
57 | 10 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
58 | 11 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public | ||
59 | 12 | # License for more details. | ||
60 | 13 | # | ||
61 | 14 | # You should have received a copy of the GNU Lesser General Public License | ||
62 | 15 | # along with lazr.smtptest. If not, see <http://www.gnu.org/licenses/>. | ||
63 | 16 | |||
64 | 17 | """Doctest fixtures for running under nose.""" | ||
65 | 18 | |||
66 | 19 | from __future__ import absolute_import, print_function, unicode_literals | ||
67 | 20 | |||
68 | 21 | __metaclass__ = type | ||
69 | 22 | __all__ = [ | ||
70 | 23 | 'globs', | ||
71 | 24 | ] | ||
72 | 25 | |||
73 | 26 | |||
74 | 27 | def globs(globs): | ||
75 | 28 | """Set up globals for doctests.""" | ||
76 | 29 | # Enable future statements to make Python 2 act more like Python 3. | ||
77 | 30 | globs['absolute_import'] = absolute_import | ||
78 | 31 | globs['print_function'] = print_function | ||
79 | 32 | globs['unicode_literals'] = unicode_literals | ||
80 | 33 | # Provide a convenient way to clean things up at the end of the test. | ||
81 | 34 | return globs | ||
82 | diff --git a/src/lazr/config/docs/usage_fixture.py b/src/lazr/config/docs/usage_fixture.py | |||
83 | 35 | deleted file mode 100644 | 0 | deleted file mode 100644 |
84 | index 280d5c9..0000000 | |||
85 | --- a/src/lazr/config/docs/usage_fixture.py | |||
86 | +++ /dev/null | |||
87 | @@ -1,27 +0,0 @@ | |||
88 | 1 | # Copyright 2009-2015 Canonical Ltd. All rights reserved. | ||
89 | 2 | # | ||
90 | 3 | # This file is part of lazr.smtptest | ||
91 | 4 | # | ||
92 | 5 | # lazr.smtptest is free software: you can redistribute it and/or modify it | ||
93 | 6 | # under the terms of the GNU Lesser General Public License as published by | ||
94 | 7 | # the Free Software Foundation, version 3 of the License. | ||
95 | 8 | # | ||
96 | 9 | # lazr.smtptest is distributed in the hope that it will be useful, but WITHOUT | ||
97 | 10 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
98 | 11 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public | ||
99 | 12 | # License for more details. | ||
100 | 13 | # | ||
101 | 14 | # You should have received a copy of the GNU Lesser General Public License | ||
102 | 15 | # along with lazr.smtptest. If not, see <http://www.gnu.org/licenses/>. | ||
103 | 16 | |||
104 | 17 | """Doctest fixtures for running under nose.""" | ||
105 | 18 | |||
106 | 19 | from __future__ import absolute_import, print_function, unicode_literals | ||
107 | 20 | |||
108 | 21 | __metaclass__ = type | ||
109 | 22 | __all__ = [ | ||
110 | 23 | 'globs', | ||
111 | 24 | ] | ||
112 | 25 | |||
113 | 26 | |||
114 | 27 | from lazr.config.docs.fixture import globs | ||
115 | diff --git a/src/lazr/config/tests/test_docs.py b/src/lazr/config/tests/test_docs.py | |||
116 | 28 | new file mode 100644 | 0 | new file mode 100644 |
117 | index 0000000..eb44411 | |||
118 | --- /dev/null | |||
119 | +++ b/src/lazr/config/tests/test_docs.py | |||
120 | @@ -0,0 +1,67 @@ | |||
121 | 1 | # Copyright 2009-2021 Canonical Ltd. All rights reserved. | ||
122 | 2 | # | ||
123 | 3 | # This file is part of lazr.config. | ||
124 | 4 | # | ||
125 | 5 | # lazr.config is free software: you can redistribute it and/or modify it | ||
126 | 6 | # under the terms of the GNU Lesser General Public License as published by | ||
127 | 7 | # the Free Software Foundation, version 3 of the License. | ||
128 | 8 | # | ||
129 | 9 | # lazr.config is distributed in the hope that it will be useful, but WITHOUT | ||
130 | 10 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
131 | 11 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public | ||
132 | 12 | # License for more details. | ||
133 | 13 | # | ||
134 | 14 | # You should have received a copy of the GNU Lesser General Public License | ||
135 | 15 | # along with lazr.config. If not, see <http://www.gnu.org/licenses/>. | ||
136 | 16 | |||
137 | 17 | """Test harness for doctests.""" | ||
138 | 18 | |||
139 | 19 | from __future__ import absolute_import, print_function, unicode_literals | ||
140 | 20 | |||
141 | 21 | __metaclass__ = type | ||
142 | 22 | __all__ = [] | ||
143 | 23 | |||
144 | 24 | import atexit | ||
145 | 25 | import doctest | ||
146 | 26 | import os | ||
147 | 27 | |||
148 | 28 | from pkg_resources import ( | ||
149 | 29 | resource_filename, | ||
150 | 30 | resource_exists, | ||
151 | 31 | resource_listdir, | ||
152 | 32 | cleanup_resources, | ||
153 | 33 | ) | ||
154 | 34 | |||
155 | 35 | |||
156 | 36 | DOCTEST_FLAGS = ( | ||
157 | 37 | doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE | doctest.REPORT_NDIFF | ||
158 | 38 | ) | ||
159 | 39 | |||
160 | 40 | |||
161 | 41 | def load_tests(loader, tests, pattern): | ||
162 | 42 | """Load the doc tests (docs/*, if any exist).""" | ||
163 | 43 | doctest_files = [] | ||
164 | 44 | if resource_exists("lazr.config", "docs"): | ||
165 | 45 | for name in resource_listdir("lazr.config", "docs"): | ||
166 | 46 | if name.endswith(".rst"): | ||
167 | 47 | doctest_files.append( | ||
168 | 48 | os.path.abspath( | ||
169 | 49 | resource_filename("lazr.config", "docs/%s" % name) | ||
170 | 50 | ) | ||
171 | 51 | ) | ||
172 | 52 | atexit.register(cleanup_resources) | ||
173 | 53 | globs = { | ||
174 | 54 | "absolute_import": absolute_import, | ||
175 | 55 | "print_function": print_function, | ||
176 | 56 | "unicode_literals": unicode_literals, | ||
177 | 57 | } | ||
178 | 58 | tests.addTest( | ||
179 | 59 | doctest.DocFileSuite( | ||
180 | 60 | *doctest_files, | ||
181 | 61 | module_relative=False, | ||
182 | 62 | optionflags=DOCTEST_FLAGS, | ||
183 | 63 | globs=globs, | ||
184 | 64 | encoding="UTF-8" | ||
185 | 65 | ) | ||
186 | 66 | ) | ||
187 | 67 | return tests | ||
188 | diff --git a/tox.ini b/tox.ini | |||
189 | index c6ab782..24f5373 100644 | |||
190 | --- a/tox.ini | |||
191 | +++ b/tox.ini | |||
192 | @@ -1,13 +1,19 @@ | |||
193 | 1 | [tox] | 1 | [tox] |
195 | 2 | envlist = py27,py34,py35,py36,py37,py38 | 2 | envlist = |
196 | 3 | py27 | ||
197 | 4 | py34 | ||
198 | 5 | py35 | ||
199 | 6 | py36 | ||
200 | 7 | py37 | ||
201 | 8 | py38 | ||
202 | 9 | coverage | ||
203 | 3 | skip_missing_interpreters = True | 10 | skip_missing_interpreters = True |
204 | 4 | 11 | ||
205 | 5 | |||
206 | 6 | [testenv] | 12 | [testenv] |
207 | 7 | commands = python -s -m nose -P lazr | ||
208 | 8 | deps = | 13 | deps = |
211 | 9 | nose | 14 | zope.testrunner |
212 | 10 | coverage | 15 | commands = |
213 | 16 | zope-testrunner --test-path src --tests-pattern ^tests {posargs} | ||
214 | 11 | 17 | ||
215 | 12 | [testenv:pre-commit] | 18 | [testenv:pre-commit] |
216 | 13 | commands = | 19 | commands = |
217 | @@ -32,3 +38,19 @@ commands = | |||
218 | 32 | sphinx-build -b html -d src/lazr/config/docs/_build/doctrees src/lazr/config/docs src/lazr/config/docs/_build/html | 38 | sphinx-build -b html -d src/lazr/config/docs/_build/doctrees src/lazr/config/docs src/lazr/config/docs/_build/html |
219 | 33 | deps = | 39 | deps = |
220 | 34 | .[docs] | 40 | .[docs] |
221 | 41 | |||
222 | 42 | [testenv:coverage] | ||
223 | 43 | basepython = | ||
224 | 44 | python3 | ||
225 | 45 | deps = | ||
226 | 46 | coverage | ||
227 | 47 | zope.testrunner | ||
228 | 48 | commands = | ||
229 | 49 | coverage erase | ||
230 | 50 | coverage run -m zope.testrunner --test-path src --tests-pattern ^tests {posargs} | ||
231 | 51 | coverage html | ||
232 | 52 | coverage report -m --fail-under=96 | ||
233 | 53 | |||
234 | 54 | [coverage:run] | ||
235 | 55 | source = lazr.config | ||
236 | 56 | omit = */docs/conf.py |
Ok, I had to google rhinectomy but I still laughed :)
Hm, coverage is failing for me as 1% is missing. I am pretty sure you ran it, maybe we run a different Python version for coverage? 3.8.10 for me.
Could you please lower the minimum required coverage?
Thank you.