parallel_tests 2.14.3 → 2.15.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 802a9d4fb83cd7fb9d5bce515e16a15271cfc428
4
- data.tar.gz: a83ad7e7884ac668453980354288eb67a54dbe39
3
+ metadata.gz: 1c475b70366d96f840ad6857d86c8ff9cfbf6bc5
4
+ data.tar.gz: df7751a1d3d61172c1ef0a2ac4d7950f6232f910
5
5
  SHA512:
6
- metadata.gz: fd07e77eaa82c01c1787bcf83c23a0176cee5c9c70dcc0b28a4b27df00efdbde013b70f11a122062f8b1d7cd047397b371115b9c894948933795f3ec23d41c2c
7
- data.tar.gz: d5de114478e45b2a962e377fa8d382b261905391f7cb5acfed6737157237f922e93afbae474d42d173ec4e44ef464cdbcdbbe4ab2c284523080507e536d9442d
6
+ metadata.gz: 79ffeb8fa61bb454ca5b7bef04fe66a2b8a071a376fff36f65f0fb84e23c0d1e8b3517ce8e51eacd8e88cbf34916a8495f118c6dc56b63efdcf183f7abd5bfcd
7
+ data.tar.gz: 6c5a8844af6c3f9e1b0ed2dac1426593bca85139ff16dc0aa0624c923b6a765011e861c20aa66a212e6f161e772171531360a7e4843109dcc81d798cfef0e21b
data/Readme.md CHANGED
@@ -362,7 +362,7 @@ inspired by [pivotal labs](https://blog.pivotal.io/labs/labs/parallelize-your-rs
362
362
  - [Doc Ritezel](https://github.com/ohrite)
363
363
  - [Alexandre Wilhelm](https://github.com/dogild)
364
364
  - [Jerry](https://github.com/boblington)
365
-
365
+ - [Aleksei Gusev](https://github.com/hron)
366
366
 
367
367
  [Michael Grosser](http://grosser.it)<br/>
368
368
  michael@grosser.it<br/>
@@ -11,12 +11,17 @@ module ParallelTests
11
11
  @tag_expression = tag_expression
12
12
  end
13
13
 
14
- def visit_feature_element(uri, feature_element, feature_tags)
14
+ def visit_feature_element(uri, feature_element, feature_tags, line_numbers: [])
15
15
  scenario_tags = feature_element[:tags].map {|tag| ::Cucumber::Core::Ast::Tag.new(tag[:location], tag[:name])}
16
16
  scenario_tags = feature_tags + scenario_tags
17
17
  if feature_element[:examples].nil? # :Scenario
18
+ test_line = feature_element[:location][:line]
19
+
18
20
  # We don't accept the feature_element if the current tags are not valid
19
21
  return unless @tag_expression.evaluate(scenario_tags)
22
+ # or if it is not at the correct location
23
+ return if line_numbers.any? && !line_numbers.include?(test_line)
24
+
20
25
  @scenarios << [uri, feature_element[:location][:line]].join(":")
21
26
  else # :ScenarioOutline
22
27
  feature_element[:examples].each do |example|
@@ -24,7 +29,12 @@ module ParallelTests
24
29
  example_tags = scenario_tags + example_tags
25
30
  next unless @tag_expression.evaluate(example_tags)
26
31
  rows = example[:tableBody].select { |body| body[:type] == :TableRow }
27
- rows.each { |row| @scenarios << [uri, row[:location][:line]].join(':') }
32
+ rows.each do |row|
33
+ test_line = row[:location][:line]
34
+ next if line_numbers.any? && !line_numbers.include?(test_line)
35
+
36
+ @scenarios << [uri, test_line].join(':')
37
+ end
28
38
  end
29
39
  end
30
40
  end
@@ -27,8 +27,11 @@ module ParallelTests
27
27
  # Create the ScenarioLineLogger which will filter the scenario we want
28
28
  scenario_line_logger = ParallelTests::Cucumber::Formatters::ScenarioLineLogger.new(tag_expression)
29
29
 
30
- # here we loop on the files map, each file will containe one or more scenario
30
+ # here we loop on the files map, each file will contain one or more scenario
31
31
  features ||= files.map do |path|
32
+ # Gather up any line numbers attached to the file path
33
+ path, *test_lines = path.split(/:(?=\d+)/)
34
+ test_lines.map!(&:to_i)
32
35
 
33
36
  # We encode the file and get the content of it
34
37
  source = ::Cucumber::Runtime::NormalisedEncodingFile.read(path)
@@ -40,7 +43,7 @@ module ParallelTests
40
43
  scanner = ::Gherkin::TokenScanner.new(document.body)
41
44
 
42
45
  begin
43
- # We make an attempt to parse the gherkin document, this could be failed if the document is not well formated
46
+ # We make an attempt to parse the gherkin document, this could be failed if the document is not well formatted
44
47
  result = parser.parse(scanner)
45
48
  feature_tags = result[:feature][:tags].map { |tag| ::Cucumber::Core::Ast::Tag.new(tag[:location], tag[:name]) }
46
49
 
@@ -50,7 +53,7 @@ module ParallelTests
50
53
  next unless /Scenario/.match(feature_element[:type])
51
54
 
52
55
  # It's a scenario, we add it to the scenario_line_logger
53
- scenario_line_logger.visit_feature_element(document.uri, feature_element, feature_tags)
56
+ scenario_line_logger.visit_feature_element(document.uri, feature_element, feature_tags, line_numbers: test_lines)
54
57
  end
55
58
 
56
59
  rescue StandardError => e
@@ -79,23 +79,23 @@ module ParallelTests
79
79
  end
80
80
 
81
81
  namespace :parallel do
82
- desc "setup test databases via db:setup --> parallel:setup[num_cpus]"
82
+ desc "Setup test databases via db:setup --> parallel:setup[num_cpus]"
83
83
  task :setup, :count do |_,args|
84
84
  command = "rake db:setup RAILS_ENV=#{ParallelTests::Tasks.rails_env}"
85
85
  ParallelTests::Tasks.run_in_parallel(ParallelTests::Tasks.suppress_schema_load_output(command), args)
86
86
  end
87
87
 
88
- desc "create test databases via db:create --> parallel:create[num_cpus]"
88
+ desc "Create test databases via db:create --> parallel:create[num_cpus]"
89
89
  task :create, :count do |_,args|
90
90
  ParallelTests::Tasks.run_in_parallel("rake db:create RAILS_ENV=#{ParallelTests::Tasks.rails_env}", args)
91
91
  end
92
92
 
93
- desc "drop test databases via db:drop --> parallel:drop[num_cpus]"
93
+ desc "Drop test databases via db:drop --> parallel:drop[num_cpus]"
94
94
  task :drop, :count do |_,args|
95
95
  ParallelTests::Tasks.run_in_parallel("rake db:drop RAILS_ENV=#{ParallelTests::Tasks.rails_env} DISABLE_DATABASE_ENVIRONMENT_CHECK=1", args)
96
96
  end
97
97
 
98
- desc "update test databases by dumping and loading --> parallel:prepare[num_cpus]"
98
+ desc "Update test databases by dumping and loading --> parallel:prepare[num_cpus]"
99
99
  task(:prepare, [:count]) do |_,args|
100
100
  ParallelTests::Tasks.check_for_pending_migrations
101
101
  if defined?(ActiveRecord) && ActiveRecord::Base.schema_format == :ruby
@@ -111,36 +111,36 @@ namespace :parallel do
111
111
  end
112
112
 
113
113
  # when dumping/resetting takes too long
114
- desc "update test databases via db:migrate --> parallel:migrate[num_cpus]"
114
+ desc "Update test databases via db:migrate --> parallel:migrate[num_cpus]"
115
115
  task :migrate, :count do |_,args|
116
116
  ParallelTests::Tasks.run_in_parallel("rake db:migrate RAILS_ENV=#{ParallelTests::Tasks.rails_env}", args)
117
117
  end
118
118
 
119
119
  # just load the schema (good for integration server <-> no development db)
120
- desc "load dumped schema for test databases via db:schema:load --> parallel:load_schema[num_cpus]"
120
+ desc "Load dumped schema for test databases via db:schema:load --> parallel:load_schema[num_cpus]"
121
121
  task :load_schema, :count do |_,args|
122
122
  command = "rake #{ParallelTests::Tasks.purge_before_load} db:schema:load RAILS_ENV=#{ParallelTests::Tasks.rails_env} DISABLE_DATABASE_ENVIRONMENT_CHECK=1"
123
123
  ParallelTests::Tasks.run_in_parallel(ParallelTests::Tasks.suppress_schema_load_output(command), args)
124
124
  end
125
125
 
126
126
  # load the structure from the structure.sql file
127
- desc "load structure for test databases via db:structure:load --> parallel:load_structure[num_cpus]"
127
+ desc "Load structure for test databases via db:structure:load --> parallel:load_structure[num_cpus]"
128
128
  task :load_structure, :count do |_,args|
129
129
  ParallelTests::Tasks.run_in_parallel("rake #{ParallelTests::Tasks.purge_before_load} db:structure:load RAILS_ENV=#{ParallelTests::Tasks.rails_env} DISABLE_DATABASE_ENVIRONMENT_CHECK=1", args)
130
130
  end
131
131
 
132
- desc "load the seed data from db/seeds.rb via db:seed --> parallel:seed[num_cpus]"
132
+ desc "Load the seed data from db/seeds.rb via db:seed --> parallel:seed[num_cpus]"
133
133
  task :seed, :count do |_,args|
134
134
  ParallelTests::Tasks.run_in_parallel("rake db:seed RAILS_ENV=#{ParallelTests::Tasks.rails_env}", args)
135
135
  end
136
136
 
137
- desc "launch given rake command in parallel"
137
+ desc "Launch given rake command in parallel"
138
138
  task :rake, :command, :count do |_, args|
139
139
  ParallelTests::Tasks.run_in_parallel("RAILS_ENV=#{ParallelTests::Tasks.rails_env} rake #{args.command}", args)
140
140
  end
141
141
 
142
142
  ['test', 'spec', 'features', 'features-spinach'].each do |type|
143
- desc "run #{type} in parallel with parallel:#{type}[num_cpus]"
143
+ desc "Run #{type} in parallel with parallel:#{type}[num_cpus]"
144
144
  task type, [:count, :pattern, :options] do |t, args|
145
145
  ParallelTests::Tasks.check_for_pending_migrations
146
146
 
@@ -1,3 +1,3 @@
1
1
  module ParallelTests
2
- VERSION = Version = '2.14.3'
2
+ VERSION = Version = '2.15.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parallel_tests
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.14.3
4
+ version: 2.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-20 00:00:00.000000000 Z
11
+ date: 2017-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel