Skip to content

Commit a20a734

Browse files
committed
Tests: added support for coverage
1 parent 23d4a97 commit a20a734

File tree

6 files changed

+28
-4
lines changed

6 files changed

+28
-4
lines changed

.coveragerc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[run]
2+
parallel = True
3+
omit =
4+
*/qwt/tests/*
5+
6+
[report]
7+
exclude_lines =
8+
if __name__ == .__main__.:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ for more details on API limitations when comparing to Qwt.
9494

9595
### Optional dependencies
9696

97-
- pytest, pytest-qt (for unit tests)
97+
- coverage, pytest, pytest-qt, pytest-cov (for unit tests)
9898
- sphinx (for documentation generation)
9999

100100
## Installation

doc/installation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Requirements:
1010
* QtPy >= 1.3
1111
* NumPy 1.x (x>=5)
1212
* Sphinx 1.x (x>=1) for documentation generation
13-
* pytest for unit testing
13+
* pytest, pytest-cov, pytest-qt, coverage for unit testing
1414

1515
Installation
1616
------------

qwt/tests/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def parse_args(self):
6565
choices=[self.UNATTENDED_ARG, self.SCREENSHOTS_ARG],
6666
required=False,
6767
)
68-
args = parser.parse_args()
68+
args, _unknown = parser.parse_known_args()
6969
if args.mode is not None:
7070
self.set_env_from_args(args)
7171

scripts/run_test_coverage.bat

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
@echo off
2+
REM ======================================================
3+
REM Test coverage script
4+
REM ======================================================
5+
REM Licensed under the terms of the MIT License
6+
REM Copyright (c) 2020 Pierre Raybaut
7+
REM (see LICENSE file for more details)
8+
REM ======================================================
9+
setlocal
10+
call %~dp0utils GetScriptPath SCRIPTPATH
11+
call %FUNC% SetPythonPath
12+
call %FUNC% UseWinPython
13+
cd %SCRIPTPATH%\..\
14+
pytest --cov=qwt --cov-report=html
15+
start htmlcov\index.html
16+
call %FUNC% EndOfScript

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def get_subpackages(name):
111111
install_requires=["NumPy>=1.5", "QtPy>=1.3"],
112112
extras_require={
113113
"doc": ["Sphinx>=1.1"],
114-
"test": ["pytest", "pytest-qt"]
114+
"test": ["coverage", "pytest", "pytest-qt", "pytest-cov"],
115115
},
116116
entry_points={
117117
"gui_scripts": [

0 commit comments

Comments
 (0)