Skip to content
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

Add column of "trace_source" #14

Closed
mpadge opened this issue Sep 8, 2022 · 3 comments
Closed

Add column of "trace_source" #14

mpadge opened this issue Sep 8, 2022 · 3 comments

Comments

@mpadge
Copy link
Owner

mpadge commented Sep 8, 2022

With value of either "examples" or "tests". For ropensci-review-tools/autotest#76

@mpadge
Copy link
Owner Author

mpadge commented Sep 9, 2022

Re-opened because this extra column has to be put in the tracing template too, to ensure consistent trace structure. At present, traces created from packages have this column, but traces from functions do not.

@mpadge
Copy link
Owner Author

mpadge commented Jun 22, 2023

Nope, not quite. Still some buggy behaviour with capturing the correct calling environment

@mpadge mpadge reopened this Jun 22, 2023
mpadge added a commit that referenced this issue Jun 22, 2023
@mpadge mpadge closed this as completed in ef4f5f7 Jun 22, 2023
@mpadge
Copy link
Owner Author

mpadge commented Jun 22, 2023

Here is the output applied to a modified version of geodist which has one example wrapped in tryCatch.

library (typetracer)
packageVersion ("typetracer")
#> [1] '0.1.1.37'
path <- "/<path>/<to>/hypertidy/geodist"
res <- trace_package (pkg_dir = path)
table (res$call_env)
#> 
#>               base::lapply             base::tryCatch 
#>                         56                          4 
#>           geodist::geodist geodist::geodist_benchmark 
#>                        560                          6 
#>       geodist::geodist_min       geodist::geodist_vec 
#>                         20                        180 
#>          geodist::georange     testthat::expect_error 
#>                        100                         58 
#>   testthat::expect_message    testthat::expect_silent 
#>                         82                         41

Created on 2023-06-22 with reprex v2.0.2

(Note that this doesn't actually work in reprex, because that uses a fresh environment which strips all typetracer injections. This has been lightly faked.)

And the "call_env" column enables identication of function calls which are made under various expections, importantly including try/tryCatch, and all testthat::expect_ functions. Those can then be ignored in autotest to finally capture only calls expected to succeed, and so properly trace acceptable parameter types 🚀 🍾

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant