From: Mauricio Fernandez Date: 2006-07-28T06:38:20+09:00 Subject: Re: Wrapped method causing infinite recursion in rcov On Fri, Jul 28, 2006 at 04:55:15AM +0900, Mauricio Fernandez wrote: > On Fri, Jul 28, 2006 at 01:57:56AM +0900, Caleb Clausen wrote: > > On 7/27/06, Pedro C�rte-Real wrote: > rcov doesn't redefine anything, it just uses a trace_func (or the C > equivalent when rcovrt is available). In theory, running a program through > rcov shouldn't change its behavior, but this is the second time I'm told > there's some sort of bothersome interference with Rails (I haven't yet been > able to fix the first issue, reported by Assaph Mehr). ======================================== Meanwhile, I've figured this one out. Rails was interfering with itself: rake test runs unit, functional and integration tests in three separate processes. If you load them all simultaneously, you can run into puzzling errors (reported for the wrong controllers, as SomeController.new.class != SomeController in some circumstances (!)). So we're down to one bug/strange interaction. Let's address it: if you are defining the coverage task like this: Rcov::RcovTask.new(:converage) do |t| t.libs << "test" t.test_files = FileList['test/**/*_test.rb'] t.output_dir = 'test/coverage' t.verbose = true t.rcov_opts << '--rails' end the helper could get loaded twice if it is being required in both the unit _and_ the functional tests (Rails does ugly things with $: and require). We can get some evidence to support that theory by monitoring #require, as shown in my previous message. At any rate, I will soon implement the ability to merge coverage data from several runs, allowing you to run the tests separately and obtain a single coverage figure. -- Mauricio Fernandez - http://eigenclass.org - singular Ruby