ruby-progressbar icon indicating copy to clipboard operation
ruby-progressbar copied to clipboard

Test failure

Open dleidert opened this issue 4 years ago • 3 comments

I am currently packaging your latest release for the Debian distribution. For this we run the tests and I see an error:


  1) ProgressBar::Base can be converted into a hash
     Failure/Error:
       expect(progressbar.to_h).to \
         include(
           'output_stream'                       => be_a(StringIO),
           'length'                              => 92,
           'elapsed_time_in_seconds'             => be_within(0.01).of(600),
           'estimated_time_remaining_in_seconds' => 400,
           'percentage'                          => 66.66,
           'progress'                            => 22,
           'progress_mark'                       => 'x',
           'base_rate_of_change'                 => 0.03672787979966611,

       expected {"base_rate_of_change" => 0.03666666666666667, "elapsed_time_in_seconds" => 600.000050724, "estimated_tim...tle" => "My Title", "total" => 33, "unknown_progress_animation_steps" => ["=---", "-=--", "--=-", "---="]} 
     to include {"base_rate_of_change" => 0.03672787979966611, "scaled_rate_of_change" => 7.345575959933222}
       Diff:


       @@ -1,15 +1,15 @@
       -"base_rate_of_change" => 0.03672787979966611,
       -"elapsed_time_in_seconds" => (be within 0.01 of 600),
       +"base_rate_of_change" => 0.03666666666666667,
       +"elapsed_time_in_seconds" => 600.000050724,
        "estimated_time_remaining_in_seconds" => 400,
        "finished?" => false,
        "length" => 92,
       -"output_stream" => (be a kind of StringIO),
       +"output_stream" => #<StringIO:0x0000562e04ebb198>,
        "percentage" => 66.66,
        "progress" => 22,
        "progress_mark" => "x",
        "remainder_mark" => "-",
       -"scaled_rate_of_change" => 7.345575959933222,
       -"started?" => (be within 1 of 2021-09-10 12:05:34 UTC),
       +"scaled_rate_of_change" => 7.333333333333333,
       +"started?" => 2021-09-10 12:05:34.734004527 +0000,
        "stopped?" => false,
        "throttle_rate" => 12.3,
        "title" => "My Title",
     # ./spec/lib/ruby-progressbar/base_spec.rb:573:in `block (2 levels) in <class:ProgressBar>'

Finished in 0.28803 seconds (files took 0.11581 seconds to load)
207 examples, 1 failure, 5 pending

Failed examples:

rspec ./spec/lib/ruby-progressbar/base_spec.rb:557 # ProgressBar::Base can be converted into a hash

I'm currently running it in our CI. So hopefully I can provide you with a test protocol.

Environment

Debian Sid/amd64, Laptop with an Intel i7-7700

dleidert avatar Sep 10 '21 13:09 dleidert

It seems the Fedora guys commented out this test as well (probably due to the same issue): https://src.fedoraproject.org/rpms/rubygem-progressbar/blob/rawhide/f/rubygem-progressbar.spec#_71-72

dleidert avatar Sep 12 '21 13:09 dleidert

It seems that both Fedora and Debian are testing without rspectacular. Not sure if this causes the difference.

dleidert avatar Sep 12 '21 15:09 dleidert

@dleidert that would be the problem. rspectacular provides test metadata for ruby-progressbar and progressbar. If you remove it, then the time mocking will fail, which is why you're seeing your test failures. Add it back and you should see the tests pass properly.

jfelchner avatar Feb 26 '23 02:02 jfelchner

Also apologies for the long delay in reply. Somehow this one snuck through my filter.

jfelchner avatar Feb 26 '23 02:02 jfelchner