Skip to content

Commit fba1f77

Browse files
authored
Merge pull request #2641 from ruby/backport-multiple-skip-files
Allows the use of a path list as RBS_SKIP_TESTS
2 parents 8c362dc + 49edf97 commit fba1f77

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

lib/rbs/collection.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# frozen_string_literal: true
22

33
require 'yaml'
4+
require 'fileutils'
45

56
require_relative './cli/colored_io'
67
require_relative './collection/sources'

test/test_skip.rb

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,11 @@
1515
# ```
1616
#
1717
module TestSkip
18-
env = ENV["RBS_SKIP_TESTS"]
19-
SKIP_TESTS_FILE =
20-
if env
21-
Pathname(env)
22-
end
18+
SKIP_TESTS_FILES = ENV["RBS_SKIP_TESTS"]&.split(File::PATH_SEPARATOR)
2319

2420
SKIP_TESTS =
25-
if SKIP_TESTS_FILE
26-
SKIP_TESTS_FILE.each_line.with_object({}) do |line, hash|
21+
SKIP_TESTS_FILES&.each_with_object({}) do |file, hash|
22+
File.foreach(file) do |line|
2723
line.chomp!
2824
line.gsub!(/#.*/, "")
2925
line.strip!
@@ -32,19 +28,20 @@ module TestSkip
3228

3329
name, message = line.split(/\s+/, 2)
3430

35-
hash[name] = message
31+
hash[name] = [file, message]
3632
end
3733
end
3834

3935
if SKIP_TESTS
4036
def setup
4137
super
4238

43-
if SKIP_TESTS.key?(name) || SKIP_TESTS.key?(self.class.name)
44-
if message = SKIP_TESTS[name] || SKIP_TESTS[self.class.name]
45-
omit "Skip test by RBS_SKIP_TESTS(#{SKIP_TESTS_FILE}): #{message}"
39+
file, message = SKIP_TESTS[name] || SKIP_TESTS[self.class.name]
40+
if file
41+
if message
42+
omit "Skip test by RBS_SKIP_TESTS(#{file}): #{message}"
4643
else
47-
omit "Skip test by RBS_SKIP_TESTS(#{SKIP_TESTS_FILE})"
44+
omit "Skip test by RBS_SKIP_TESTS(#{file})"
4845
end
4946
end
5047
end
@@ -54,7 +51,7 @@ def teardown
5451
when passed?
5552
# nop
5653
else
57-
puts "💡You can skip this test `#{name}` by adding the name to `#{SKIP_TESTS_FILE}`"
54+
puts "💡You can skip this test `#{name}` by adding the name to `#{SKIP_TESTS_FILES.join('`, `')}`"
5855
end
5956

6057
super

0 commit comments

Comments
 (0)