Don't run the adapter tests when a test selection is made

If `bin/test file_to_test.rb` is called, we should not be running
all the test for that adapter, only the test file we selected.
This commit is contained in:
Rafael Mendonça França 2023-02-13 21:23:59 +00:00
parent 3efe5e21b8
commit 90f4b3d96e
No known key found for this signature in database
GPG Key ID: FC23B6D0F1EEE948
2 changed files with 7 additions and 6 deletions

View File

@ -11,11 +11,13 @@ require "active_support"
require "active_support/test_case"
require "rake/testtask"
Rails::TestUnit::Runner.singleton_class.prepend Module.new {
private
def list_tests(argv)
def list_tests(patterns)
tests = super
tests.concat FileList["test/cases/adapters/#{adapter_name}/**/*_test.rb"]
tests.concat FileList["test/cases/adapters/#{adapter_name}/**/*_test.rb"] if patterns.empty?
tests
end
def default_test_exclude_glob

View File

@ -45,7 +45,8 @@ module Rails
end
def load_tests(argv)
tests = list_tests(argv)
patterns = extract_filters(argv)
tests = list_tests(patterns)
tests.to_a.each { |path| require File.expand_path(path) }
end
@ -96,9 +97,7 @@ module Rails
PATH_ARGUMENT_PATTERN.match?(arg)
end
def list_tests(argv)
patterns = extract_filters(argv)
def list_tests(patterns)
tests = Rake::FileList[patterns.any? ? patterns : default_test_glob]
tests.exclude(default_test_exclude_glob) if patterns.empty?
tests