markbates / markbates/cover_me
project.store setting not honored in parallel
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 203
- Forks
- 17
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
I'm trying to use cover_me 1.0.0.rc6 while running my Rails 3.0.7 app's test suite in parallel with [test-loop](https://github.com/sunaku/test-loop). Since these parallel tests cannot all write to the same `coverage.data` file simultaneously, I wanted to assign each of them a unique `coverage.data` file in my `test/test_helper.rb` file in the following ways.
## Starting CoverMe at the top of my `test/test_helper.rb` in the master process:
``` ruby
require 'cover_me'
ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
Test::Loop.before_each_test.push lambda {
|test_file, log_file, test_names|
CoverMe.config do |c|
c.project.store = test_file + '.coverage.data'
c.html_formatter.output_path = test_file + '.coverage'
end
}
```
## Starting CoverMe in a worker process just before it loads and runs a `test/**_test.rb` file from my Rails app test suite:
``` ruby
ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
Test::Loop.before_each_test.push lambda {
|test_file, log_file, test_names|
require 'cover_me'
CoverMe.config do |c|
c.project.store = test_file + '.coverage.data'
c.html_formatter.output_path = test_file + '.coverage'
end
}
```
## Starting CoverMe (after configuring its output locations) in a worker process just before it loads and runs a `test/**_test.rb` file from my Rails app test suite:
``` ruby
ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
Test::Loop.before_each_test.push lambda {
|test_file, log_file, test_names|
require 'cover_me'
CoverMe.config do |c|
c.project.store = test_file + '.coverage.data'
c.html_formatter.output_path = test_file + '.coverage'
end
CoverMe.complete!
}
```
None of these worked; all workers write to the same `coverage.data` at the root of my Rails app. Any ideas?
Thanks for your consideration.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with test/test_helper.rb and the three CoverMe.config examples, then inspect how project.store is read when cover_me loads in the test-loop worker. Reproduce the parallel run and trace why workers still write to the root coverage.data file. Done means each worker uses its configured coverage.data path without interfering with the others.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rails, ruby
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100