Skip to content

Commit c6ee8c5

Browse files
authored
Merge pull request rails#41810 from leequarella/forced-test_order
Revert overwriting test_order
2 parents 886793b + 1d50a37 commit c6ee8c5

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

activesupport/lib/active_support/test_case.rb

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,6 @@ def parallelize(workers: :number_of_processors, with: :processes)
9191
Minitest.parallel_executor = executor
9292

9393
parallelize_me!
94-
95-
# `Minitest::Test.parallelize_me!` will try to change `test_order` to return
96-
# `:parallel`. However, since `ActiveSupport::TestCase` is already overriding it,
97-
# in some inheritance situations, it will have precedence over the `Minitest` one.
98-
# For this reason, it needs to be updated by hand.
99-
self.test_order = :parallel
10094
end
10195

10296
# Set up hook for parallel testing. This can be used if you have multiple

railties/test/application/test_runner_test.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -547,14 +547,14 @@ def test_parallel_is_disabled_when_single_file_is_run
547547
548548
class ParallelTest < ActiveSupport::TestCase
549549
def test_verify_test_order
550-
puts "Test order: \#{self.class.test_order}"
550+
puts "Test parallelization disabled: \#{ActiveSupport.test_parallelization_disabled}"
551551
end
552552
end
553553
RUBY
554554

555555
output = run_test_command(file_name)
556556

557-
assert_match "Test order: random", output
557+
assert_match "Test parallelization disabled: true", output
558558
end
559559

560560
def test_parallel_is_enabled_when_multiple_files_are_run
@@ -565,7 +565,7 @@ def test_parallel_is_enabled_when_multiple_files_are_run
565565
566566
class ParallelTestFirst < ActiveSupport::TestCase
567567
def test_verify_test_order
568-
puts "Test order (file 1): \#{self.class.test_order}"
568+
puts "Test parallelization disabled (file 1): \#{ActiveSupport.test_parallelization_disabled}"
569569
end
570570
end
571571
RUBY
@@ -575,15 +575,15 @@ def test_verify_test_order
575575
576576
class ParallelTestSecond < ActiveSupport::TestCase
577577
def test_verify_test_order
578-
puts "Test order (file 2): \#{self.class.test_order}"
578+
puts "Test parallelization disabled (file 2): \#{ActiveSupport.test_parallelization_disabled}"
579579
end
580580
end
581581
RUBY
582582

583583
output = run_test_command([file_1, file_2].join(" "))
584584

585-
assert_match "Test order (file 1): parallel", output
586-
assert_match "Test order (file 2): parallel", output
585+
assert_match "Test parallelization disabled (file 1): false", output
586+
assert_match "Test parallelization disabled (file 2): false", output
587587
end
588588

589589
def test_parallel_is_enabled_when_PARALLEL_WORKERS_is_set
@@ -597,14 +597,14 @@ def test_parallel_is_enabled_when_PARALLEL_WORKERS_is_set
597597
598598
class ParallelTest < ActiveSupport::TestCase
599599
def test_verify_test_order
600-
puts "Test order: \#{self.class.test_order}"
600+
puts "Test parallelization disabled: \#{ActiveSupport.test_parallelization_disabled}"
601601
end
602602
end
603603
RUBY
604604

605605
output = run_test_command(file_name)
606606

607-
assert_match "Test order: parallel", output
607+
assert_match "Test parallelization disabled: false", output
608608
ensure
609609
ENV["PARALLEL_WORKERS"] = @old
610610
end

0 commit comments

Comments
 (0)