Skip to content

Commit

Permalink
Detect when being run inside parallel_tests (Issue simplecov-ruby#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
jshraibman-mdsol committed Jan 7, 2013
1 parent b27a28a commit fd6c621
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/simplecov/command_guesser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,19 @@ class << self
attr_accessor :original_run_command

def guess
from_command_line_options || from_defined_constants
from_env || from_command_line_options || from_defined_constants
end

private

def from_env
# If being run from inside parallel_tests set the command name according to the process number
if ENV['PARALLEL_TEST_GROUPS'] && ENV['TEST_ENV_NUMBER']
number = ENV['TEST_ENV_NUMBER']
number = '1' if number == ''
"(#{number}/#{ENV['PARALLEL_TEST_GROUPS']})"
end
end

def from_command_line_options
case original_run_command
Expand Down

0 comments on commit fd6c621

Please sign in to comment.