Note that it is possible to manually create a Python Analysis Unit if necessary:
Automatic skipping of unit-test code and external libraries
The analyzer skips files that are recognized as forming part of testing code, i.e., in principle, code not pertaining to production code. The reason to avoid inclusion of testing code is that many Quality Rule violations are overrepresented in test code, either because code tends to be of poorer quality (certainly not critical) or prevalence of particular testing patterns. Accounting for test code would negatively impact the total score of the project.
Similarly we skip folders that contain external python libraries. Currently we only skip the canonical folders site-packages and dist-packages (the latter being used in certain Linux distributions). Not only analyzing external libraries is discouraged, but it can interfere with correct interpretation of supported libraries and frameworks, and have a serious impact in memory consumption and overall analysis performance.
The heuristics used by the analyzer are based on detecting unit-test library imports, and file and path naming conventions as summarized in the table below:
|FileContent||from unittest import||12|
|FileContent||from nose.tools import||12|
|The ** symbol represents any arbitrary path string, whereas * represents any string without directory slashes.|
The following structural rules are provided: