Skip to content

Commit dbdc766

Browse files
committed
Allows the use of a path list as RBS_SKIP_TESTS
In ruby/ruby test-bundled-gems, rbs has many failures on Windows. Currently we ignore all failures in this test totally, but that is the test-run makes no sense but just wastes times. So I want to also specify another file for the tests to be skipped only on Windows, in addition to the platform independent skipping list file, that we are using already.
1 parent c248581 commit dbdc766

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

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)