[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 27/32] python/aqmp: Add Coverage.py support
From: |
John Snow |
Subject: |
[PULL 27/32] python/aqmp: Add Coverage.py support |
Date: |
Mon, 27 Sep 2021 15:25:08 -0400 |
I'm not exposing this via the Makefile help, it's not likely to be
useful to passersby. Switch the avocado runner to the 'legacy' runner
for now, as the new runner seems to obscure coverage reports, again.
Usage is to enter your venv of choice and then:
`make check-coverage && xdg-open htmlcov/index.html`.
Signed-off-by: John Snow <jsnow@redhat.com>
Message-id: 20210915162955.333025-28-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
---
python/.gitignore | 5 +++++
python/Makefile | 9 +++++++++
python/avocado.cfg | 3 +++
python/setup.cfg | 10 ++++++++++
4 files changed, 27 insertions(+)
diff --git a/python/.gitignore b/python/.gitignore
index c8b0e67fe6c..904f324bb11 100644
--- a/python/.gitignore
+++ b/python/.gitignore
@@ -15,3 +15,8 @@ qemu.egg-info/
.venv/
.tox/
.dev-venv/
+
+# Coverage.py reports
+.coverage
+.coverage.*
+htmlcov/
diff --git a/python/Makefile b/python/Makefile
index fe27a3e12ee..33343113625 100644
--- a/python/Makefile
+++ b/python/Makefile
@@ -92,6 +92,13 @@ check:
check-tox:
@tox $(QEMU_TOX_EXTRA_ARGS)
+.PHONY: check-coverage
+check-coverage:
+ @coverage run -m avocado --config avocado.cfg run tests/*.py
+ @coverage combine
+ @coverage html
+ @coverage report
+
.PHONY: clean
clean:
python3 setup.py clean --all
@@ -100,3 +107,5 @@ clean:
.PHONY: distclean
distclean: clean
rm -rf qemu.egg-info/ .venv/ .tox/ $(QEMU_VENV_DIR) dist/
+ rm -f .coverage .coverage.*
+ rm -rf htmlcov/
diff --git a/python/avocado.cfg b/python/avocado.cfg
index 10dc6fb6054..c7722e7ecd3 100644
--- a/python/avocado.cfg
+++ b/python/avocado.cfg
@@ -1,3 +1,6 @@
+[run]
+test_runner = runner
+
[simpletests]
# Don't show stdout/stderr in the test *summary*
status.failure_fields = ['status']
diff --git a/python/setup.cfg b/python/setup.cfg
index 8481fa7c923..4fd0c68a5b7 100644
--- a/python/setup.cfg
+++ b/python/setup.cfg
@@ -140,3 +140,13 @@ deps =
.[fuse] # Workaround to trigger tox venv rebuild
commands =
make check
+
+# Coverage.py [https://coverage.readthedocs.io/en/latest/] is a tool for
+# measuring code coverage of Python programs. It monitors your program,
+# noting which parts of the code have been executed, then analyzes the
+# source to identify code that could have been executed but was not.
+
+[coverage:run]
+concurrency = multiprocessing
+source = qemu/
+parallel = true
--
2.31.1
- [PULL 18/32] python/pylint: disable no-member check, (continued)
- [PULL 18/32] python/pylint: disable no-member check, John Snow, 2021/09/27
- [PULL 19/32] python/aqmp: Add message routing to QMP protocol, John Snow, 2021/09/27
- [PULL 21/32] python/aqmp: add _raw() execution interface, John Snow, 2021/09/27
- [PULL 20/32] python/aqmp: add execute() interfaces, John Snow, 2021/09/27
- [PULL 22/32] python/aqmp: add asyncio_run compatibility wrapper, John Snow, 2021/09/27
- [PULL 23/32] python/aqmp: add scary message, John Snow, 2021/09/27
- [PULL 09/32] python/aqmp: add AsyncProtocol.accept() method, John Snow, 2021/09/27
- [PULL 24/32] python: bump avocado to v90.0, John Snow, 2021/09/27
- [PULL 25/32] python/aqmp: add AsyncProtocol unit tests, John Snow, 2021/09/27
- [PULL 26/32] python/aqmp: add LineProtocol tests, John Snow, 2021/09/27
- [PULL 27/32] python/aqmp: Add Coverage.py support,
John Snow <=
- [PULL 28/32] python: Add dependencies for AQMP TUI, John Snow, 2021/09/27
- [PULL 29/32] python/aqmp-tui: Add AQMP TUI, John Snow, 2021/09/27
- [PULL 30/32] python: Add entry point for aqmp-tui, John Snow, 2021/09/27
- [PULL 31/32] python: add optional pygments dependency, John Snow, 2021/09/27
- [PULL 32/32] python/aqmp-tui: Add syntax highlighting, John Snow, 2021/09/27
- Re: [PULL 00/32] Python patches, Peter Maydell, 2021/09/28