Merge ~cjwatson/lazr.restful:coverage into lazr.restful:main

Proposed by Colin Watson
Status: Merged
Merged at revision: 5b51fbd1cac70f7cd0acfc445fcf70ee6a95c50a
Proposed branch: ~cjwatson/lazr.restful:coverage
Merge into: lazr.restful:main
Diff against target: 52 lines (+19/-0)
2 files modified
.gitignore (+2/-0)
tox.ini (+17/-0)
Reviewer Review Type Date Requested Status
Jürgen Gmach Approve
Review via email: mp+414029@code.launchpad.net

Commit message

Add coverage testing

To post a comment you must log in.
Revision history for this message
Jürgen Gmach (jugmac00) wrote (last edit ):

Thanks a lot! Not sure what bit I was missing.

Coverage is and remains magic :-)

The current output looks like...

```
.tox/coverage/lib/python3.8/site-packages/lazr/restful/tests/test_etag.py 118 9 92% 47, 52-56, 64-67, 74-89, 100-120
.tox/coverage/lib/python3.8/site-packages/lazr/restful/tests/test_navigation.py 69 1 99% 58
.tox/coverage/lib/python3.8/site-packages/lazr/restful/tests/test_utils.py 116 0 100%
.tox/coverage/lib/python3.8/site-packages/lazr/restful/tests/test_webservice.py 525 5 99% 119, 873, 1011, 1032, 1061
.tox/coverage/lib/python3.8/site-packages/lazr/restful/utils.py 193 6 97% 152, 306, 402, 451-459
.tox/coverage/lib/python3.8/site-packages/lazr/restful/wsgi.py 36 18 50% 32-33, 36-50, 57-61, 66-67
--------------------------------------------------------------------------------------------------------------------------------------
TOTAL 6636 434 93%
__________________________________________________________________________________ summary ___________________________________________________________________________________
  coverage: commands succeeded
  congratulations :)
```

Usually, you would add a `[coverage:paths]` section, and add something like...

```
[coverage:paths]
source =
    src
    .tox/*/site-packages
```

and then you'd get a nicer output (ie src/lazr/restful/.../test_function.py ...), but for reasons unknown it does not work here, at least for me.

review: Approve
Revision history for this message
Colin Watson (cjwatson) wrote :

Right, I tried `coverage:paths` too and couldn't see why it wasn't working. Odd, but I didn't want to spend too much time on it, and this at least works.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/.gitignore b/.gitignore
index ee6caa6..d2b3b94 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,10 +1,12 @@
1*.egg-info1*.egg-info
2*.pyc2*.pyc
3.coverage
3.DS_Store4.DS_Store
4.tox5.tox
5bin6bin
6build7build
7dist8dist
9htmlcov
8MANIFEST10MANIFEST
9src/lazr/restful/docs/_build11src/lazr/restful/docs/_build
10TAGS12TAGS
diff --git a/tox.ini b/tox.ini
index c191378..4b07cac 100644
--- a/tox.ini
+++ b/tox.ini
@@ -8,6 +8,7 @@ envlist =
8 py398 py39
9 py3109 py310
10 docs10 docs
11 coverage
1112
12[testenv]13[testenv]
13deps =14deps =
@@ -31,6 +32,22 @@ deps =
31commands =32commands =
32 sphinx-build -b html -d src/lazr/restful/docs/_build/doctrees src/lazr/restful/docs src/lazr/restful/docs/_build/html33 sphinx-build -b html -d src/lazr/restful/docs/_build/doctrees src/lazr/restful/docs src/lazr/restful/docs/_build/html
3334
35[testenv:coverage]
36basepython = python3
37deps =
38 .[test,xml]
39 zope.testrunner
40 coverage
41commands =
42 coverage erase
43 coverage run -m zope.testrunner --test-path src --tests-pattern ^tests {posargs}
44 coverage html
45 coverage report -m --fail-under=93
46
47[coverage:run]
48source = lazr.restful
49omit = */docs/conf.py
50
34[flake8]51[flake8]
35ignore =52ignore =
36 # incompatible with black53 # incompatible with black

Subscribers

People subscribed via source and target branches