On Fri, Oct 25, 2013 at 11:16 PM, Hadley Wickham
<notifications@github.com>wrote:

> In R/test-files.r:
>
> > @@ -29,12 +33,13 @@ test_dir <- function(path, filter = NULL, reporter = "summary", env = NULL) {
> >      files <- files[grepl(filter, test_names)]
> >    }
> >
> > -  old <- setwd(path)
> > -  on.exit(setwd(old))
> > -  with_reporter(reporter, lapply(files, function(file) {
> > -    sys.source2(file, envir = new.env(parent = env))
> > -    end_context()
> > -  }))
> > +  .custom_test_file <- function(fname) {
> > +    lister$start_file(fname)
>
> Could reporter also be an argument to .test_file so that it always adds
> and resets the context?
>

I think that .test_file() ends properly the context by the call to
end_context().
The contexts should be added by the tests scripts themselves by calling
context() right ?

[  For now, the only callers of .test_file() are test_dir and test_file,
that both call it within a  with_reporter. ]

> —
> Reply to this email directly or view it on GitHub<https://github.com/hadley/testthat/pull/98/files#r7228707>
> .
>