mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Merge d6f1ad2089
into d025bc230c
This commit is contained in:
commit
81fc431389
2 changed files with 35 additions and 9 deletions
|
@ -789,11 +789,11 @@ module Test
|
||||||
unless rep.empty?
|
unless rep.empty?
|
||||||
rep.each do |r|
|
rep.each do |r|
|
||||||
if r[:error]
|
if r[:error]
|
||||||
puke(*r[:error], Timeout::Error.new)
|
puke(*r[:error], Timeout::Error.new, r[:file])
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
r[:report]&.each do |f|
|
r[:report]&.each do |f|
|
||||||
puke(*f) if f
|
puke(*f, r[:file]) if f
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if @options[:retry]
|
if @options[:retry]
|
||||||
|
@ -1396,7 +1396,36 @@ module Test
|
||||||
end
|
end
|
||||||
|
|
||||||
module LaunchableOption
|
module LaunchableOption
|
||||||
module Nothing
|
module Runner
|
||||||
|
def puke(klass, meth, e, file=nil)
|
||||||
|
if writer = options[:launchable_test_reports]
|
||||||
|
# # Since `record` method is not called when a timeout occurs while waiting for the worker's response, we need to capture it here.
|
||||||
|
if file && e.is_a?(Timeout::Error)
|
||||||
|
status = 'TEST_FAILED'
|
||||||
|
e = "Timeout:\n#{klass}##{meth}\n"
|
||||||
|
full_path = File.expand_path(file)
|
||||||
|
repo_path = File.expand_path("#{__dir__}/../../../")
|
||||||
|
relative_path = full_path.delete_prefix("#{repo_path}/")
|
||||||
|
# The test path is a URL-encoded representation.
|
||||||
|
# https://github.com/launchableinc/cli/blob/v1.81.0/launchable/testpath.py#L18
|
||||||
|
test_path = {file: relative_path, class: klass, testcase: meth}.map{|key, val|
|
||||||
|
"#{encode_test_path_component(key)}=#{encode_test_path_component(val)}"
|
||||||
|
}.join('#')
|
||||||
|
writer.write_object(
|
||||||
|
{
|
||||||
|
testPath: test_path,
|
||||||
|
status: status,
|
||||||
|
duration: options[:worker_timeout],
|
||||||
|
createdAt: Time.now.to_s,
|
||||||
|
stderr: e,
|
||||||
|
stdout: nil
|
||||||
|
}
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def setup_options(opts, options)
|
def setup_options(opts, options)
|
||||||
super
|
super
|
||||||
|
@ -1422,9 +1451,6 @@ module Test
|
||||||
when Test::Unit::AssertionFailedError
|
when Test::Unit::AssertionFailedError
|
||||||
status = 'TEST_FAILED'
|
status = 'TEST_FAILED'
|
||||||
"Failure:\n#{suite.name}##{method} [#{location error}]:\n#{error.message}\n"
|
"Failure:\n#{suite.name}##{method} [#{location error}]:\n#{error.message}\n"
|
||||||
when Timeout::Error
|
|
||||||
status = 'TEST_FAILED'
|
|
||||||
"Timeout:\n#{suite.name}##{method}\n"
|
|
||||||
else
|
else
|
||||||
status = 'TEST_FAILED'
|
status = 'TEST_FAILED'
|
||||||
bt = Test::filter_backtrace(error.backtrace).join "\n "
|
bt = Test::filter_backtrace(error.backtrace).join "\n "
|
||||||
|
@ -1802,7 +1828,7 @@ module Test
|
||||||
prepend Test::Unit::ExcludesOption
|
prepend Test::Unit::ExcludesOption
|
||||||
prepend Test::Unit::TimeoutOption
|
prepend Test::Unit::TimeoutOption
|
||||||
prepend Test::Unit::RunCount
|
prepend Test::Unit::RunCount
|
||||||
prepend Test::Unit::LaunchableOption::Nothing
|
prepend Test::Unit::LaunchableOption::Runner
|
||||||
|
|
||||||
##
|
##
|
||||||
# Begins the full test run. Delegates to +runner+'s #_run method.
|
# Begins the full test run. Delegates to +runner+'s #_run method.
|
||||||
|
@ -1828,7 +1854,7 @@ module Test
|
||||||
alias orig_run_suite _run_suite
|
alias orig_run_suite _run_suite
|
||||||
|
|
||||||
# Overriding of Test::Unit::Runner#puke
|
# Overriding of Test::Unit::Runner#puke
|
||||||
def puke klass, meth, e
|
def puke klass, meth, e, file=nil
|
||||||
n = report.size
|
n = report.size
|
||||||
e = case e
|
e = case e
|
||||||
when Test::Unit::PendedError then
|
when Test::Unit::PendedError then
|
||||||
|
|
|
@ -167,7 +167,7 @@ module Test
|
||||||
abort("#{e.inspect} in _report(#{res.inspect}, #{args.inspect})\n#{e.backtrace.join("\n")}")
|
abort("#{e.inspect} in _report(#{res.inspect}, #{args.inspect})\n#{e.backtrace.join("\n")}")
|
||||||
end
|
end
|
||||||
|
|
||||||
def puke(klass, meth, e) # :nodoc:
|
def puke(klass, meth, e, file=nil) # :nodoc:
|
||||||
if e.is_a?(Test::Unit::PendedError)
|
if e.is_a?(Test::Unit::PendedError)
|
||||||
new_e = Test::Unit::PendedError.new(e.message)
|
new_e = Test::Unit::PendedError.new(e.message)
|
||||||
new_e.set_backtrace(e.backtrace)
|
new_e.set_backtrace(e.backtrace)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue