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

Provide a way to start context for extention packages #1082

Closed
yutannihilation opened this issue Jul 5, 2020 · 4 comments
Closed

Provide a way to start context for extention packages #1082

yutannihilation opened this issue Jul 5, 2020 · 4 comments

Comments

@yutannihilation
Copy link
Contributor

yutannihilation commented Jul 5, 2020

I'm implementing r-lib/vdiffr#88 to let vdiffr get rid of explicit context(). At the time of starting it, I thought I just can use testthat::context() inside start_test(). But, now context() is deprecated, and ProgressReporter uses an unexported function start_context(). So, now I don't know what to do.

start_file = function(file) {
self$file_name <- file
self$ctxt_issues <- Stack$new()
self$ctxt_start_time <- proc.time()
name <- context_name(self$file_name)
context_start(name)
},

Are there any way for external packages to do the same thing as ProgressReporter does? Or, more broadly, what is the supposed way of implementing a custom reporter at the moment...?

@hadley
Copy link
Member

hadley commented Jul 5, 2020

Hmmm maybe the right thing to do is export something like start_file_context() for use by external reporters.

But we should also talk about what you’re doing in vdiffr because I’ve been thinking that the new snapshot functions (not implemented yet) should be designed to be extensible so vdiffr could become much simpler.

@yutannihilation
Copy link
Contributor Author

Honestly, I don't know well about the internals of vdiffr. I just wanted to remove all context() in ggplot2, and expected it was an easy job to tweak vdiffr's reporter. If vdiffr needs some major refactoring, I think I'm not the right person to do it...

@hadley
Copy link
Member

hadley commented Jul 5, 2020

Ok, I just wanted to make sure you weren't doing a bunch of work on vdiffr that I was about to make obsolete 😄

@hadley hadley closed this as completed in 89ea33f Jul 5, 2020
@yutannihilation
Copy link
Contributor Author

Thanks!

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

2 participants