parallel_tests 0.3.4 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.markdown CHANGED
@@ -48,7 +48,7 @@ Example output
48
48
 
49
49
  Even process runtimes (for specs only atm)
50
50
  -----------------
51
- Add to your `spec/parallel_specs.opts` (or `spec/spec.opts`) :
51
+ Add to your `spec/parallel_spec.opts` (or `spec/spec.opts`) :
52
52
  --format ParallelSpecs::SpecRuntimeLogger:tmp/parallel_profile.log
53
53
  It will log test runtime and partition the test-load accordingly.
54
54
 
@@ -109,7 +109,8 @@ inspired by [pivotal labs](http://pivotallabs.com/users/miked/blog/articles/849-
109
109
  - [Joakim Kolsjö](http://www.rubyblocks.se)
110
110
  - [Kevin Scaldeferri](http://kevin.scaldeferri.com/blog/)
111
111
  - [Kpumuk](http://kpumuk.info/)
112
- - [Maksim Horbu](http://github.com/mhorbul)
112
+ - [Maksim Horbul](http://github.com/mhorbul)
113
+ - [Pivotal Labs][http://pivotallabs.com]
113
114
  - [Rohan Deshpande](http://github.com/rdeshpande)
114
115
  - [Tchandy](http://thiagopradi.net/)
115
116
  - [Terence Lee](http://hone.heroku.com/)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.4
1
+ 0.3.5
data/bin/parallel_test CHANGED
@@ -13,6 +13,7 @@ Options are:
13
13
  BANNER
14
14
  opts.on("-n [PROCESSES]", Integer, "How many processes to use, default: available CPUs"){|n| options[:count] = n }
15
15
  opts.on("-p", '--path [PATH]', "run tests inside this path only"){|path| options[:path_prefix] = path }
16
+ opts.on("-f", '--files path/to/test_file,path/to/other_test_file]', Array, "run these test files (comma-separated list w/o spaces)"){|files| options[:files] = files }
16
17
  opts.on("-r", '--root [PATH]', "execute test commands from this path"){|path| options[:root] = path }
17
18
  opts.on("-e", '--exec [COMMAND]', "execute this code parallel and with ENV['TEST_ENV_NUM']"){|path| options[:execute] = path }
18
19
  opts.on("-o", '--test-options [SOMETHING]', "execute test commands with those options"){|arg| options[:test_options] = arg }
@@ -44,7 +45,7 @@ else
44
45
  tests_folder = File.join(task, options[:path_prefix].to_s)
45
46
  tests_folder = File.join(options[:root], tests_folder) unless options[:root].to_s.empty?
46
47
 
47
- groups = klass.tests_in_groups(tests_folder, num_processes)
48
+ groups = klass.tests_in_groups(options[:files] || tests_folder, num_processes)
48
49
  num_processes = groups.size
49
50
 
50
51
  #adjust processes to groups
@@ -19,6 +19,10 @@ class ParallelCucumber < ParallelTests
19
19
 
20
20
  protected
21
21
 
22
+ def self.test_suffix
23
+ ".feature"
24
+ end
25
+
22
26
  def self.line_is_result?(line)
23
27
  line =~ /^\d+ (steps|scenarios)/
24
28
  end
@@ -26,8 +30,4 @@ class ParallelCucumber < ParallelTests
26
30
  def self.line_is_failure?(line)
27
31
  line =~ /^\d+ (steps|scenarios).*(\d{2,}|[1-9]) failed/
28
32
  end
29
-
30
- def self.find_tests(root)
31
- Dir["#{root}**/**/*.feature"]
32
- end
33
33
  end
@@ -21,7 +21,7 @@ class ParallelSpecs < ParallelTests
21
21
 
22
22
  protected
23
23
 
24
- def self.find_tests(root)
25
- Dir["#{root}**/**/*_spec.rb"]
24
+ def self.test_suffix
25
+ "_spec.rb"
26
26
  end
27
27
  end
@@ -108,7 +108,15 @@ class ParallelTests
108
108
  end
109
109
  end
110
110
 
111
+ def self.test_suffix
112
+ "_test.rb"
113
+ end
114
+
111
115
  def self.find_tests(root)
112
- Dir["#{root}**/**/*_test.rb"]
116
+ if root.is_a?(Array)
117
+ root
118
+ else
119
+ Dir["#{root}**/**/*#{self.test_suffix}"]
120
+ end
113
121
  end
114
122
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{parallel_tests}
8
- s.version = "0.3.4"
8
+ s.version = "0.3.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Michael Grosser"]
12
- s.date = %q{2010-03-27}
12
+ s.date = %q{2010-05-01}
13
13
  s.email = %q{grosser.michael@gmail.com}
14
14
  s.executables = ["parallel_test", "parallel_spec", "parallel_cucumber"]
15
15
  s.extra_rdoc_files = [
@@ -4,7 +4,7 @@ describe 'CLI' do
4
4
  end
5
5
 
6
6
  after do
7
- `rm -rf #{folder}`
7
+ # `rm -rf #{folder}`
8
8
  end
9
9
 
10
10
  def folder
@@ -27,7 +27,7 @@ describe 'CLI' do
27
27
  end
28
28
 
29
29
  def run_specs(options={})
30
- `cd #{folder} && #{executable} -t spec -n #{options[:processes]||2} 2>&1 && echo 'i ran!'`
30
+ `cd #{folder} && #{executable} -t spec -n #{options[:processes]||2} #{options[:add]} 2>&1 && echo 'i ran!'`
31
31
  end
32
32
 
33
33
  it "runs tests in parallel" do
@@ -81,4 +81,14 @@ describe 'CLI' do
81
81
  expected = ((Parallel.processor_count == 1 or ENV['RUN_CODE_RUN']) ? 10 : 5)
82
82
  (Time.now - t).should <= expected
83
83
  end
84
+
85
+ it "can run with given files" do
86
+ write "x1_spec.rb", "puts '111'"
87
+ write "x2_spec.rb", "puts '222'"
88
+ write "x3_spec.rb", "puts '333'"
89
+ result = run_specs(:add => '--files spec/x1_spec.rb,spec/x3_spec.rb')
90
+ result.should include('111')
91
+ result.should include('333')
92
+ result.should_not include('222')
93
+ end
84
94
  end
data/spec/spec_helper.rb CHANGED
@@ -30,6 +30,12 @@ def test_tests_in_groups(klass, folder, suffix)
30
30
  `rm -f #{@log}`
31
31
  end
32
32
 
33
+ it "groups when given an array of files" do
34
+ list_of_files = Dir["#{test_root}/**/*#{suffix}"]
35
+ found = klass.find_tests_with_sizes(list_of_files)
36
+ found.should =~ list_of_files.map{ |file| [file, File.stat(file).size]}
37
+ end
38
+
33
39
  it "finds all tests" do
34
40
  found = klass.tests_in_groups(test_root, 1)
35
41
  all = [ Dir["#{test_root}/**/*#{suffix}"] ]
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 4
9
- version: 0.3.4
8
+ - 5
9
+ version: 0.3.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Michael Grosser
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-27 00:00:00 +01:00
17
+ date: 2010-05-01 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency