Merge pull request #41810 from leequarella/forced-test_order

Revert overwriting test_order
This commit is contained in:
Eileen M. Uchitelle 2021-04-01 08:36:43 -04:00 committed by GitHub
commit c6ee8c5c4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 14 deletions

View File

@ -91,12 +91,6 @@ module ActiveSupport
Minitest.parallel_executor = executor
parallelize_me!
# `Minitest::Test.parallelize_me!` will try to change `test_order` to return
# `:parallel`. However, since `ActiveSupport::TestCase` is already overriding it,
# in some inheritance situations, it will have precedence over the `Minitest` one.
# For this reason, it needs to be updated by hand.
self.test_order = :parallel
end
# Set up hook for parallel testing. This can be used if you have multiple

View File

@ -547,14 +547,14 @@ module ApplicationTests
class ParallelTest < ActiveSupport::TestCase
def test_verify_test_order
puts "Test order: \#{self.class.test_order}"
puts "Test parallelization disabled: \#{ActiveSupport.test_parallelization_disabled}"
end
end
RUBY
output = run_test_command(file_name)
assert_match "Test order: random", output
assert_match "Test parallelization disabled: true", output
end
def test_parallel_is_enabled_when_multiple_files_are_run
@ -565,7 +565,7 @@ module ApplicationTests
class ParallelTestFirst < ActiveSupport::TestCase
def test_verify_test_order
puts "Test order (file 1): \#{self.class.test_order}"
puts "Test parallelization disabled (file 1): \#{ActiveSupport.test_parallelization_disabled}"
end
end
RUBY
@ -575,15 +575,15 @@ module ApplicationTests
class ParallelTestSecond < ActiveSupport::TestCase
def test_verify_test_order
puts "Test order (file 2): \#{self.class.test_order}"
puts "Test parallelization disabled (file 2): \#{ActiveSupport.test_parallelization_disabled}"
end
end
RUBY
output = run_test_command([file_1, file_2].join(" "))
assert_match "Test order (file 1): parallel", output
assert_match "Test order (file 2): parallel", output
assert_match "Test parallelization disabled (file 1): false", output
assert_match "Test parallelization disabled (file 2): false", output
end
def test_parallel_is_enabled_when_PARALLEL_WORKERS_is_set
@ -597,14 +597,14 @@ module ApplicationTests
class ParallelTest < ActiveSupport::TestCase
def test_verify_test_order
puts "Test order: \#{self.class.test_order}"
puts "Test parallelization disabled: \#{ActiveSupport.test_parallelization_disabled}"
end
end
RUBY
output = run_test_command(file_name)
assert_match "Test order: parallel", output
assert_match "Test parallelization disabled: false", output
ensure
ENV["PARALLEL_WORKERS"] = @old
end