ruby-concurrency / concurrent-ruby

Modern concurrency tools including agents, futures, promises, thread pools, supervisors, and more. Inspired by Erlang, Clojure, Scala, Go, Java, JavaScript, and classic concurrency patterns.
https://ruby-concurrency.github.io/concurrent-ruby/
Other
5.68k stars 418 forks source link

Specs: Use latest timecop v0.9.4, to fix ruby-head #914

Closed olleolleolle closed 3 years ago

olleolleolle commented 3 years ago

This PR asks for a Timecop with a non-exact version, 0.9, which resolves to 0.9.4. That version supports Ruby 3.1 aka ruby-head. Timecop changelog.

Background

Last commit to that line in the Gemfile was 6 years ago, with exact versions everywhere. https://github.com/ruby-concurrency/concurrent-ruby/commit/4cfd9c75ec2ee092796edfa7e4fba842c43f316b

Result

With this version of timecop, concurrent-ruby is green 🟢 on ruby-head.


``` /home/runner/.rubies/ruby-head/bin/ruby -I/home/runner/work/concurrent-ruby/concurrent-ruby/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.10.1/lib:/home/runner/work/concurrent-ruby/concurrent-ruby/vendor/bundle/ruby/3.1.0/gems/rspec-support-3.10.2/lib /home/runner/work/concurrent-ruby/concurrent-ruby/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.10.1/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb --color --backtrace --order defined --format documentation --tag ~notravis :301:in `initialize': no implicit conversion of Hash into Integer (TypeError) from /home/runner/work/concurrent-ruby/concurrent-ruby/vendor/bundle/ruby/3.1.0/gems/timecop-0.7.4/lib/timecop/time_extensions.rb:22:in `new' from /home/runner/work/concurrent-ruby/concurrent-ruby/vendor/bundle/ruby/3.1.0/gems/timecop-0.7.4/lib/timecop/time_extensions.rb:22:in `new_with_mock_time' from :219:in `now' from /home/runner/work/concurrent-ruby/concurrent-ruby/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.10.1/lib/rspec/core/reporter.rb:89:in `start' from /home/runner/work/concurrent-ruby/concurrent-ruby/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.10.1/lib/rspec/core/reporter.rb:72:in `report' from /home/runner/work/concurrent-ruby/concurrent-ruby/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.10.1/lib/rspec/core/runner.rb:115:in `run_specs' from /home/runner/work/concurrent-ruby/concurrent-ruby/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.10.1/lib/rspec/core/runner.rb:89:in `run' from /home/runner/work/concurrent-ruby/concurrent-ruby/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.10.1/lib/rspec/core/runner.rb:71:in `run' from /home/runner/work/concurrent-ruby/concurrent-ruby/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.10.1/lib/rspec/core/runner.rb:45:in `invoke' from /home/runner/work/concurrent-ruby/concurrent-ruby/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.10.1/exe/rspec:4:in `
' ``` This was in one of the GitHub Actions results: https://github.com/ruby-concurrency/concurrent-ruby/runs/2848609176#step:4:94
olleolleolle commented 3 years ago

@pitr-ch 👋 I think I made one of the matrix elements pass! At what cost? We'll learn.

Update I took a look around, and could not find any obviously-broken details connected to Timecop changes.

chrisseaton commented 3 years ago

Can you please rebase?

olleolleolle commented 3 years ago

@chrisseaton 🟢 Rebased!

chrisseaton commented 3 years ago

Thanks for your fix.

olleolleolle commented 3 years ago

Does this make any of the experimentals less experimental?

chrisseaton commented 3 years ago

Which experimental Ruby versions?

I need to try to get a grip on what Ruby versions we officially claim to support and document it and reflect it in CI.

olleolleolle commented 3 years ago

@chrisseaton There are 2 workflows in CI, one being scheduled to run at midnight, and targets [head, truffleruby, truffleruby-head].

The regular ci.yml one includes 2.4 and up, including latest ruby: [2.4, 2.5, 2.6, 2.7, 3.0, jruby, jruby-head].

The gemspec requires a Ruby 1.9.3+...

(Sorry, these are just random facts, which do not contribute to making an understanding of what you mentioned.)

Counter-note: I was running around in the codebase looking for opportunities to use __dir__, but that's 2.0. Now, there are hits for __dir__ in the code-base, in the tests. It has been backported: so, still 1.9.3

Rakefile
8:    def __dir__
olleolleolle commented 3 years ago

The "Supported Ruby Versions" section claims 2.0+ - so we could go to use __dir__, I guess.

https://github.com/ruby-concurrency/concurrent-ruby#supported-ruby-versions