parallel_tests 3.7.1 → 3.8.1

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
  SHA256:
3
- metadata.gz: 9bef11937f866ff4dad761906b41261246e9b5bf5bba2baa4a2c0019da0b3d42
4
- data.tar.gz: 5241a08bd2bd0a273347fa044b12e973b5f40ab899b750e5f00364a2db1b3e72
3
+ metadata.gz: e4a7071d3e5afb39f01dd57304c8fab20d985f25c2f3699a7f6e69074715e576
4
+ data.tar.gz: 64b9cb4fb05ed5cfc04554bc6fb04960fbefdf0ac756062fe01e7e15383fb1bc
5
5
  SHA512:
6
- metadata.gz: fd2d6eeb089dae8a9925d94b70de446bd9c58e9342d8602be671aea38e521577d01273d677e8b3f278c307715cf11bce4e9a661326e75a4f484de0f798f48040
7
- data.tar.gz: a14fcbccdcca6b1870af02ad24be6a316b504a6b14f8e37678c3b81894bbd7aac9a0403e7f45b37501c35c4be7e499a509b8b14bb288b139f43853c4c861fd26
6
+ metadata.gz: 61639ad8b786efee4bd6e868d244531008d7eade53e3fb419f26ce7688a0b10d8609624f078e48562b3ac5ffb4560515e2ac869ebb6ddcb7616c10e869d22f70
7
+ data.tar.gz: 2f15bd174e7e5064efa7186cdb604620cdd8aa0fb11d7702c4db3f8f558ca972385d65af51dade0ee8adaf80229673785f57c9160e3d38046c56a0ce539217c3
data/Readme.md CHANGED
@@ -42,6 +42,9 @@ test:
42
42
 
43
43
  ### Setup environment from scratch (create db and loads schema, useful for CI)
44
44
  rake parallel:setup
45
+
46
+ ### Drop all test databases
47
+ rake parallel:drop
45
48
 
46
49
  ### Run!
47
50
  rake parallel:test # Test::Unit
@@ -43,14 +43,14 @@ module ParallelTests
43
43
 
44
44
  def read
45
45
  sync do
46
- contents = IO.read(file_path)
46
+ contents = File.read(file_path)
47
47
  return if contents.empty?
48
48
  @pids = JSON.parse(contents)
49
49
  end
50
50
  end
51
51
 
52
52
  def save
53
- sync { IO.write(file_path, pids.to_json) }
53
+ sync { File.write(file_path, pids.to_json) }
54
54
  end
55
55
 
56
56
  def sync(&block)
@@ -92,6 +92,32 @@ module ParallelTests
92
92
 
93
93
  [num_processes, pattern.to_s, options.to_s, pass_through.to_s]
94
94
  end
95
+
96
+ def schema_format_based_on_rails_version
97
+ if rails_7_or_greater?
98
+ ActiveRecord.schema_format
99
+ else
100
+ ActiveRecord::Base.schema_format
101
+ end
102
+ end
103
+
104
+ def schema_type_based_on_rails_version
105
+ if rails_61_or_greater? || schema_format_based_on_rails_version == :ruby
106
+ "schema"
107
+ else
108
+ "structure"
109
+ end
110
+ end
111
+
112
+ private
113
+
114
+ def rails_7_or_greater?
115
+ Gem::Version.new(Rails.version) >= Gem::Version.new('7.0')
116
+ end
117
+
118
+ def rails_61_or_greater?
119
+ Gem::Version.new(Rails.version) >= Gem::Version.new('6.1.0')
120
+ end
95
121
  end
96
122
  end
97
123
  end
@@ -121,14 +147,10 @@ namespace :parallel do
121
147
  desc "Update test databases by dumping and loading --> parallel:prepare[num_cpus]"
122
148
  task(:prepare, [:count]) do |_, args|
123
149
  ParallelTests::Tasks.check_for_pending_migrations
124
- if defined?(ActiveRecord::Base) && [:ruby, :sql].include?(ActiveRecord::Base.schema_format)
150
+
151
+ if defined?(ActiveRecord) && [:ruby, :sql].include?(ParallelTests::Tasks.schema_format_based_on_rails_version)
125
152
  # fast: dump once, load in parallel
126
- type =
127
- if Gem::Version.new(Rails.version) >= Gem::Version.new('6.1.0')
128
- "schema"
129
- else
130
- ActiveRecord::Base.schema_format == :ruby ? "schema" : "structure"
131
- end
153
+ type = ParallelTests::Tasks.schema_type_based_on_rails_version
132
154
 
133
155
  Rake::Task["db:#{type}:dump"].invoke
134
156
 
@@ -163,7 +185,8 @@ namespace :parallel do
163
185
  # just load the schema (good for integration server <-> no development db)
164
186
  desc "Load dumped schema for test databases via db:schema:load --> parallel:load_schema[num_cpus]"
165
187
  task :load_schema, :count do |_, args|
166
- command = "#{ParallelTests::Tasks.rake_bin} #{ParallelTests::Tasks.purge_before_load} " \
188
+ command =
189
+ "#{ParallelTests::Tasks.rake_bin} #{ParallelTests::Tasks.purge_before_load} " \
167
190
  "db:schema:load RAILS_ENV=#{ParallelTests::Tasks.rails_env} DISABLE_DATABASE_ENVIRONMENT_CHECK=1"
168
191
  ParallelTests::Tasks.run_in_parallel(ParallelTests::Tasks.suppress_schema_load_output(command), args)
169
192
  end
@@ -211,7 +234,8 @@ namespace :parallel do
211
234
  # Using the relative path to find the binary allow to run a specific version of it
212
235
  executable = File.join(File.dirname(__FILE__), '..', '..', 'bin', 'parallel_test')
213
236
 
214
- command = "#{ParallelTests.with_ruby_binary(Shellwords.escape(executable))} #{type} " \
237
+ command =
238
+ "#{ParallelTests.with_ruby_binary(Shellwords.escape(executable))} #{type} " \
215
239
  "--type #{test_framework} " \
216
240
  "-n #{count} " \
217
241
  "--pattern '#{pattern}' " \
@@ -24,7 +24,7 @@ module ParallelTests
24
24
  end
25
25
 
26
26
  def run_tests(test_files, process_number, num_processes, options)
27
- require_list = test_files.map { |file| file.sub(" ", "\\ ") }.join(" ")
27
+ require_list = test_files.map { |file| file.gsub(" ", "\\ ") }.join(" ")
28
28
  cmd = "#{executable} -Itest -e '%w[#{require_list}].each { |f| require %{./\#{f}} }' -- #{options[:test_options]}"
29
29
  execute_command(cmd, process_number, num_processes, options)
30
30
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module ParallelTests
3
- VERSION = '3.7.1'
3
+ VERSION = '3.8.1'
4
4
  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: 3.7.1
4
+ version: 3.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-13 00:00:00.000000000 Z
11
+ date: 2022-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel
@@ -68,8 +68,8 @@ licenses:
68
68
  - MIT
69
69
  metadata:
70
70
  bug_tracker_uri: https://github.com/grosser/parallel_tests/issues
71
- documentation_uri: https://github.com/grosser/parallel_tests/blob/v3.7.1/Readme.md
72
- source_code_uri: https://github.com/grosser/parallel_tests/tree/v3.7.1
71
+ documentation_uri: https://github.com/grosser/parallel_tests/blob/v3.8.1/Readme.md
72
+ source_code_uri: https://github.com/grosser/parallel_tests/tree/v3.8.1
73
73
  wiki_uri: https://github.com/grosser/parallel_tests/wiki
74
74
  post_install_message:
75
75
  rdoc_options: []
@@ -86,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
86
  - !ruby/object:Gem::Version
87
87
  version: '0'
88
88
  requirements: []
89
- rubygems_version: 3.2.16
89
+ rubygems_version: 3.3.10
90
90
  signing_key:
91
91
  specification_version: 4
92
92
  summary: Run Test::Unit / RSpec / Cucumber / Spinach in parallel