python-security/pyt

Improve test coverage from 91% to 100%

Open

#141 opened on Jul 7, 2018

View on GitHub
 (0 comments) (0 reactions) (0 assignees)Python (2,141 stars) (259 forks)batch import
good first issuehelp wanted

Description

Test coverage is always important, and my goal is to eventually be at 100%. I'll be sure to do this for PRs from now on, or at least try to, but there is some existing code that is not yet covered.

The good thing is that all files have existing tests, tests for __main__.py for example can be found in the main_test.py file.

By running make test you can see where we aren't yet at 100%:

py36 runtests: commands[3] | coverage report --include=pyt/* --fail-under 91
Name                                                Stmts   Miss  Cover   Missing
---------------------------------------------------------------------------------
pyt/__init__.py                                         0      0   100%
pyt/__main__.py                                        68     13    81%   45, 55-57, 70-71, 83, 86, 105-108, 129
pyt/analysis/constraint_table.py                        9      0   100%
pyt/analysis/definition_chains.py                      16      0   100%
pyt/analysis/fixed_point.py                            21      0   100%
pyt/analysis/lattice.py                                31      0   100%
pyt/analysis/reaching_definitions_taint.py             27      0   100%
pyt/cfg/__init__.py                                     2      0   100%
pyt/cfg/alias_helper.py                                33      0   100%
pyt/cfg/expr_visitor.py                               212     20    91%   70, 99-100, 111-122, 131, 136, 141, 149, 154, 407, 560
pyt/cfg/expr_visitor_helper.py                          9      0   100%
pyt/cfg/make_cfg.py                                     9      0   100%
pyt/cfg/stmt_visitor.py                               456     46    90%   111, 168, 174, 217, 235, 247-248, 277-278, 297-298, 386-399, 658-661, 668-671, 678, 684, 702-704, 780, 816-823, 868, 893, 919-920, 951, 972, 988, 1010
pyt/cfg/stmt_visitor_helper.py                         72      6    92%   83, 95-96, 133-136
pyt/core/ast_helper.py                                 53      4    92%   56, 101, 103, 105
pyt/core/module_definitions.py                         47      4    91%   32, 108-110
pyt/core/node_types.py                                 70      4    94%   51, 142-145
pyt/core/project_handler.py                            30      1    97%   23
pyt/formatters/__init__.py                              0      0   100%
pyt/helper_visitors/__init__.py                         4      0   100%
pyt/helper_visitors/label_visitor.py                  206     40    81%   31-37, 93-98, 179-184, 186-188, 200, 203, 212, 215, 218, 221, 224, 227, 230, 246, 249, 252, 255, 261, 265, 271, 274, 278, 281
pyt/helper_visitors/right_hand_side_visitor.py         13      0   100%
pyt/helper_visitors/vars_visitor.py                   104      4    96%   66-68, 102
pyt/usage.py                                           39      1    97%   124
pyt/vulnerabilities/__init__.py                         3      0   100%
pyt/vulnerabilities/trigger_definitions_parser.py      30      0   100%
pyt/vulnerabilities/vulnerabilities.py                160     15    91%   233-235, 237, 241-243, 310, 312-321, 424, 427
pyt/vulnerabilities/vulnerability_helper.py            76     19    75%   84, 116-119, 132-134, 178-182, 204-209
pyt/web_frameworks/__init__.py                          3      0   100%
pyt/web_frameworks/framework_adaptor.py                41      0   100%
pyt/web_frameworks/framework_helper.py                 23      0   100%
---------------------------------------------------------------------------------
TOTAL                                                1867    177    91%

If you would like help with writing tests for any of these files let me know.

Contributor guide

Improve test coverage from 91% to 100% · python-security/pyt#141 | Good First Issue