Skip to content

Commit 815e0f4

Browse files
committed
make: add target to make a code coverage report
Patch introduces integration with coverage.py module [1] that allows to gather code coverage and build a simple report about covered statements and branches. We have a test-run.py module itself and also we have Python helpers for Tarantool tests written in Python. These Python tests runs a separate processes using subprocess module. To make it possible to gather code coverage for these helpers there are special changes added to lib/tarantool_server.py file. Additionally patch introduces integration with Coveralls service that allows to evaluate incremental code coverage changes like we do it for Tarantool [2]. Code coverage for test-run is available on page by URL [3]. Name Stmts Miss Branch BrPart Cover --------------------------------------------------------------------- dispatcher.py 281 57 94 13 76.0% lib/__init__.py 45 0 6 1 98.0% lib/admin_connection.py 71 50 22 0 22.6% lib/app_server.py 162 104 38 2 33.0% lib/box_connection.py 54 33 12 0 31.8% lib/colorer.py 111 31 42 7 64.7% lib/connpool.py 85 65 18 0 19.4% lib/inspector.py 81 49 26 1 34.6% lib/options.py 81 15 18 6 78.8% lib/preprocessor.py 329 290 162 0 7.9% lib/pytap13.py 128 110 58 1 10.2% lib/server.py 111 62 40 2 35.1% lib/server_mixins.py 126 83 28 0 27.9% lib/tarantool_connection.py 126 89 22 0 25.0% lib/tarantool_server.py 729 547 268 9 20.8% lib/test.py 249 181 86 0 20.3% lib/test_suite.py 191 76 68 12 57.5% lib/unittest_server.py 63 25 10 2 57.5% lib/utils.py 216 113 86 12 42.7% lib/worker.py 251 179 70 3 25.2% listeners.py 205 78 70 6 60.0% test-run.py 149 76 44 9 42.5% test/unittest/test_lib_utils.py 25 1 2 1 92.6% --------------------------------------------------------------------- TOTAL 3869 2314 1290 87 35.2% 1. https://coverage.readthedocs.io/en/latest/config.html 2. https://coveralls.io/github/tarantool/tarantool 3. https://coveralls.io/github/tarantool/test-run
1 parent d01b205 commit 815e0f4

File tree

5 files changed

+38
-1
lines changed

5 files changed

+38
-1
lines changed

.coveragerc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[run]
2+
branch = True
3+
concurrency =
4+
gevent
5+
multiprocessing
6+
7+
[report]
8+
precision = 1
9+
include =
10+
./*
11+
omit =
12+
lib/tarantool-python/*
13+
lib/msgpack-python/*

.github/workflows/test.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,13 @@ jobs:
5858
- name: run regression tests
5959
run: |
6060
make test
61+
- name: code coverage
62+
if: ${{ matrix.python-version == '3.8' && matrix.tarantool-version == '2.7' }}
63+
run: |
64+
make coverage
65+
- name: upload coverage data to coveralls.io
66+
if: ${{ matrix.python-version == '3.8' && matrix.tarantool-version == '2.7' }}
67+
run: coveralls
68+
env:
69+
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
70+
COVERALLS_PARALLEL: true

Makefile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
2+
PROJECT_DIR := $(patsubst %/,%,$(dir $(MAKEFILE_PATH)))
13
TEST_RUN_EXTRA_PARAMS?=
24
PYTHON?=python
35

@@ -13,11 +15,19 @@ luacheck:
1315
luacheck --config .luacheckrc .
1416

1517
test_integration:
16-
$(PYTHON) test/test-run.py --force $(TEST_RUN_EXTRA_PARAMS)
18+
PYTHONPATH=$(PROJECT_DIR) $(PYTHON) test/test-run.py --force $(TEST_RUN_EXTRA_PARAMS)
1719

1820
test_unittest:
1921
$(PYTHON) -m unittest discover test/unittest/
2022

2123
test: test_unittest test_integration
2224

25+
coverage:
26+
PYTHON="coverage run" make -f $(MAKEFILE_PATH) test
27+
coverage combine
28+
coverage report
29+
30+
clean:
31+
coverage erase
32+
2333
.PHONY: lint flake8 luacheck test test_integration test_unittest

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Tarantool Functional testing framework
22

3+
[![Coverage Status](https://coveralls.io/repos/github/tarantool/test-run/badge.svg)](https://coveralls.io/github/tarantool/test-run)
4+
35
### Test Suite
46

57
Bunch of tests, that lay down in the subfolder (recursively) with `suite.ini`

requirements-test.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
coverage==5.*
2+
coveralls==1.*
13
flake8==3.7.9
24
hypothesis==4.*

0 commit comments

Comments
 (0)