-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tests are not included in AppMaps #351
Comments
Current behaviorWhen no Here is the process AppMap uses to determine which directories to include in the default configuration:
Here is a relevant code snippet from def find_top_packages(rootdir):
"""
Scan a directory tree for packages that should appear in the
default config file.
Examine directories in rootdir, to see if they contains an
__init__.py. If it does, add it to the list of packages and don't
scan any of its subdirectories. If it doesn't, scan its
subdirectories to find __init__.py.
Some directories are automatically excluded from the search:
* sys.prefix
* Hidden directories (i.e. those that start with a '.')
* node_modules
For example, in a directory like this
% ls -F
LICENSE Makefile appveyor.yml docs/ src/ tests/
MANIFEST.in README.rst blog/ setup.py tddium.yml tox.ini
docs, src, tests, and blog will get scanned.
Only src has a subdirectory containing an __init__.py:
"""
# Rest of the code A default name: my_project
appmap_dir: tmp/appmap
packages:
- path: src # Assuming src is a package containing __init__.py
- path: tests # Assuming tests is a package containing __init__.py You can customize this file to add other directories or exclude ones that you don't need to be instrumented. If you need more details on what to include or exclude, or have any specific requirements for your project setup, you can always update the |
Analysis: The Proposed Changes:
By implementing these changes, the function will no longer consider directories intended for test code, ensuring that only relevant application packages are included in the default |
[These are Navie's suggestions for how to test the change to add Update Tests to Ensure
|
Including test functions in recordings isn't helpful. Their presence is just noise, and confuses users (and Navie).
The default configuration generated by appmap-python should not include directories that primarily contain tests. Because there's no enforced standard for naming of test directories, appmap-python will exclude directories that match the regex
.*test.*
.In addition, test framework integration will disable recording of test functions, in case some tests have been instrumented (e.g. because they're in a module with a name that doesn't match
.*test.*
). This behavior is controlled by a property namedrecord_test_cases
inappmap.yml
, which defaults tofalse
.The text was updated successfully, but these errors were encountered: