Merge ~jugmac00/launchpadlib:add-coverage into launchpadlib:main

Proposed by Jürgen Gmach
Status: Merged
Approved by: Jürgen Gmach
Approved revision: 1bab9c2aae5d7b2acea2b41ea97e1449e54f7ac5
Merged at revision: 1bab9c2aae5d7b2acea2b41ea97e1449e54f7ac5
Proposed branch: ~jugmac00/launchpadlib:add-coverage
Merge into: launchpadlib:main
Diff against target: 105 lines (+42/-6)
5 files modified
.gitignore (+1/-0)
NEWS.rst (+5/-0)
setup.py (+5/-1)
src/launchpadlib/tests/test_launchpad.py (+6/-1)
tox.ini (+25/-4)
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Review via email: mp+417127@code.launchpad.net

Commit message

Create coverage report

To post a comment you must log in.
Revision history for this message
Jürgen Gmach (jugmac00) :
Revision history for this message
Colin Watson (cjwatson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/.gitignore b/.gitignore
2index 49b5f97..22976f2 100644
3--- a/.gitignore
4+++ b/.gitignore
5@@ -10,3 +10,4 @@ TAGS
6 tags
7 _trial_temp
8 __pycache__
9+.coverage
10diff --git a/NEWS.rst b/NEWS.rst
11index c8ca0bd..ac72636 100644
12--- a/NEWS.rst
13+++ b/NEWS.rst
14@@ -2,6 +2,11 @@
15 NEWS for launchpadlib
16 =====================
17
18+1.10.17 (unreleased)
19+====================
20+- Generate coverage report.
21+- Use ``pytest`` as test runner.
22+
23 1.10.16 (2022-01-21)
24 ====================
25 - Add ``pre-commit`` configuration.
26diff --git a/setup.py b/setup.py
27index a21d134..68542cf 100755
28--- a/setup.py
29+++ b/setup.py
30@@ -96,7 +96,11 @@ setup(
31 "wadllib",
32 ],
33 # Dependencies only needed by launchpadlib's own tests.
34- "test": ['mock; python_version < "3"'],
35+ "test": [
36+ "coverage",
37+ 'mock; python_version < "3"',
38+ "pytest",
39+ ],
40 },
41 test_suite="launchpadlib.tests",
42 )
43diff --git a/src/launchpadlib/tests/test_launchpad.py b/src/launchpadlib/tests/test_launchpad.py
44index 933f60f..f0d2bd5 100644
45--- a/src/launchpadlib/tests/test_launchpad.py
46+++ b/src/launchpadlib/tests/test_launchpad.py
47@@ -741,7 +741,12 @@ class TestDeprecatedLoginMethods(KeyringTest):
48 "ignore", r".*next release of cryptography"
49 )
50 NoNetworkLaunchpad.get_token_and_login("consumer")
51- self.assertEqual(len(caught), 1)
52+ self.assertEqual(
53+ str(caught[0].message),
54+ "The Launchpad.get_token_and_login() method is deprecated. "
55+ "You should use Launchpad.login_anonymous() for anonymous "
56+ "access and Launchpad.login_with() for all other purposes.",
57+ )
58 self.assertEqual(caught[0].category, DeprecationWarning)
59
60
61diff --git a/tox.ini b/tox.ini
62index 49f3c6e..779e1da 100644
63--- a/tox.ini
64+++ b/tox.ini
65@@ -3,11 +3,10 @@ envlist =
66 py27,py35,py36,py37,py38,py39,py310,lint,docs
67
68 [testenv]
69-commands =
70- zope-testrunner --test-path src --tests-pattern ^tests {posargs}
71 deps =
72- .[testing,test]
73- zope.testrunner
74+ .[test,testing]
75+commands =
76+ coverage run -m pytest src/launchpadlib/tests {posargs}
77
78 [testenv:lint]
79 basepython =
80@@ -24,3 +23,25 @@ commands =
81 sphinx-build -b html -d src/launchpadlib/docs/_build/doctrees src/launchpadlib/docs src/launchpadlib/docs/_build/html
82 deps =
83 .[docs]
84+
85+[testenv:coverage]
86+description = usage: tox -e py27,py35,py310,coverage
87+basepython =
88+ python3
89+deps =
90+ .[testing,test]
91+commands =
92+ coverage combine
93+ coverage html
94+ coverage report -m --fail-under=89
95+depends =
96+ py27,py35,py310
97+
98+[coverage:run]
99+parallel=True
100+omit=.tox/*
101+
102+[coverage:paths]
103+source =
104+ src
105+ .tox/*/site-packages

Subscribers

People subscribed via source and target branches