Skip to content

Check code coverage

Partially closes #486 (closed) and #500 (closed)

I propose to automatically decorate all high-api server's function with sys.settrace trick (see discussion in #486 (closed)). Since high-api is based on low-api, we automatically test also this API.

The wrapping happens only if coverage.Coverage.current() is True. Also, Anton suggested adding PYTANGO_DISABLE_COVERAGE_TRACE_PATCHING environment variable, with which user can explicitly disable wrapping, even if it is coverage run.

To run test we should use pytest-cov:

pytest --cov=tango --cov-branch

Currently, we have:

---------- coverage: platform linux, python 3.9.16-final-0 -----------
Name                                     Stmts   Miss Branch BrPart  Cover
--------------------------------------------------------------------------
tango/__init__.py                           29      0      0      0   100%
tango/api_util.py                           20      1      4      2    88%
tango/asyncio.py                            15      0      0      0   100%
tango/asyncio_executor.py                   66      5     20      6    87%
tango/attr_data.py                         225     52    102     22    76%
tango/attribute_proxy.py                   156     84     56      3    35%
tango/auto_monitor.py                       29      5      2      1    81%
tango/base_types.py                        215     87     16      2    57%
tango/callback.py                           14      0      2      1    94%
tango/client.py                            186    186     42      0     0%
tango/codec.py                              19     16      8      0    11%
tango/connection.py                        137     38     35     11    66%
tango/databaseds/__init__.py                 0      0      0      0   100%
tango/databaseds/database.py               806    806    134      0     0%
tango/databaseds/db_access/__init__.py       0      0      0      0   100%
tango/databaseds/db_access/sqlite3.py     1130   1130    316      0     0%
tango/databaseds/db_errors.py                8      8      0      0     0%
tango/db.py                                433    164    134     19    52%
tango/device_attribute.py                   43     19      4      1    53%
tango/device_class.py                      354    128    126     32    60%
tango/device_data.py                        21      1      2      1    91%
tango/device_proxy.py                      740    306    309     22    51%
tango/device_server.py                     690    137    130     17    77%
tango/encoded_attribute.py                 182    142    134      2    13%
tango/exception.py                          42     10      2      1    75%
tango/futures.py                            15      0      0      0   100%
tango/futures_executor.py                   25      2      2      0    93%
tango/gevent.py                             24      3      2      1    85%
tango/gevent_executor.py                   104      5     14      3    93%
tango/globals.py                            55     16     26      5    64%
tango/green.py                             103     11     36      6    85%
tango/group.py                             132     59     40      1    44%
tango/group_reply.py                        31     11      4      1    60%
tango/group_reply_list.py                   37     15     12      1    47%
tango/log4tango.py                         108     48     26      4    46%
tango/pipe.py                               88     62     38      1    21%
tango/pipe_data.py                         124    108     54      0     9%
tango/pytango_init.py                       83      2      4      2    95%
tango/pytango_pprint.py                     66      8     16      2    85%
tango/pyutil.py                            245     74     72      4    67%
tango/release.py                            21      0      2      0   100%
tango/server.py                            827    267    360     61    64%
tango/tango_numpy.py                        57     57     14      0     0%
tango/tango_object.py                      411    344    126      0    12%
tango/test_context.py                      323     38    105     15    87%
tango/test_utils.py                        135      6     40      2    95%
tango/time_val.py                           50     19      8      0    53%
tango/utils.py                             842    406    424     47    46%
--------------------------------------------------------------------------
TOTAL                                     9466   4886   3003    299    45%
Edited by Yury Matveyev

Merge request reports