Hi folks, looks like many of us have failing packages on the f21-build tag due to the same reason: Minitest 5 is in F21 whereas many upstream test suites are for Minitest 4.
What's the accepted wisdom to fixing these? Disable tests on f21+? Convince upstream to upgrade? Both? Other suggestions?
- Julian
On Tue, Jun 10, 2014 at 9:24 PM, Julian C. Dunn jdunn@aquezada.com wrote:
What's the accepted wisdom to fixing these? Disable tests on f21+? Convince upstream to upgrade? Both? Other suggestions?
There are a couple of approaches here.
The first step is to remove the "testrb" command and swap it for a simple ruby command. For example, see http://pkgs.fedoraproject.org/cgit/rubygem-capillary.git/commit/?id=2bba5fe9... . For capillary, that was enough to fix the build, because the test suite only used Minitest::Spec and didn't use Minitest::Unit at all.
If your gem uses Minitest::Unit then it can be a bit harder, and you'll need to port it to Minitest 5's syntax. Here's the four most common things I've run into when porting gems' test suites:
1) Rename all uses of "MiniTest::Unit::TestCase" to "Minitest::Test"
2) Change "require 'minitest/unit'" (or 'test/unit') to "require 'minitest/autorun'"
3) "assert_raise" functions should be renamed to "assert_raises"
4) "assert_not_foo" should be renamed to "refute_foo". For example, the "assert_not_nil" function is gone in Minitest 5. It should be replaced with "refute_nil".
I've found that upstreams have been fairly receptive to patches that port to Minitest 5. So far svn2git, asciidoctor, resque-cleaner, geoip, literati and charlock_holmes have all accepted the pull requests for Minitest 5 support, and there are a couple of upstreams that are still reviewing the patches.
Even if you can't port the test suite yourself, it is still a good idea to raise the issue with upstream.
If you can't get the test suite to work, mtasaka has packaged minitest4 and it's available in Rawhide as a stop-gap until we can get everything ported over.
The last resort would be to disable the test suite during %check, but that's a last resort :) Even if you have to do this, at a minimum, it would be a good idea to put "BuildRequires: rubygem(minitest4)" so that we can all track this progress centrally using repoquery.
- Ken
Dne 11.6.2014 19:00, Ken Dreyer napsal(a):
On Tue, Jun 10, 2014 at 9:24 PM, Julian C. Dunn jdunn@aquezada.com wrote:
What's the accepted wisdom to fixing these? Disable tests on f21+? Convince upstream to upgrade? Both? Other suggestions?
There are a couple of approaches here.
The first step is to remove the "testrb" command and swap it for a simple ruby command. For example, see http://pkgs.fedoraproject.org/cgit/rubygem-capillary.git/commit/?id=2bba5fe9... . For capillary, that was enough to fix the build, because the test suite only used Minitest::Spec and didn't use Minitest::Unit at all.
If your gem uses Minitest::Unit then it can be a bit harder, and you'll need to port it to Minitest 5's syntax. Here's the four most common things I've run into when porting gems' test suites:
Rename all uses of "MiniTest::Unit::TestCase" to "Minitest::Test"
Change "require 'minitest/unit'" (or 'test/unit') to "require
'minitest/autorun'"
"assert_raise" functions should be renamed to "assert_raises"
"assert_not_foo" should be renamed to "refute_foo". For example,
the "assert_not_nil" function is gone in Minitest 5. It should be replaced with "refute_nil".
I've found that upstreams have been fairly receptive to patches that port to Minitest 5. So far svn2git, asciidoctor, resque-cleaner, geoip, literati and charlock_holmes have all accepted the pull requests for Minitest 5 support, and there are a couple of upstreams that are still reviewing the patches.
Even if you can't port the test suite yourself, it is still a good idea to raise the issue with upstream.
If you can't get the test suite to work, mtasaka has packaged minitest4 and it's available in Rawhide as a stop-gap until we can get everything ported over.
Interesting. There is possible to use BR: rubygem(minitest) < 5, which would pull in the rubygem-minitest which comes from ruby SRPM.
The last resort would be to disable the test suite during %check, but that's a last resort :) Even if you have to do this, at a minimum, it would be a good idea to put "BuildRequires: rubygem(minitest4)" so that we can all track this progress centrally using repoquery.
And several other notes:
* Be aware of packages which pulls in activesupport, which depends on Minitest 5.x. For example rubygem-archivist is using the Ruby stdlib's test/unit, i.e. minitest 4.x, but in the same tame it pulls in activesupport and minitest 5.x. Of course this results in conflicts.
* We used this [1] monekypatch on several places. Not that I think it is the best solution, but it might help temporary.
Vít
[1] http://pkgs.fedoraproject.org/cgit/rubygem-raindrops.git/tree/rubygem-raindr...
On 06/12/2014 10:15 AM, Vít Ondruch wrote:
Dne 11.6.2014 19:00, Ken Dreyer napsal(a):
On Tue, Jun 10, 2014 at 9:24 PM, Julian C. Dunn jdunn@aquezada.com wrote:
What's the accepted wisdom to fixing these? Disable tests on f21+? Convince upstream to upgrade? Both? Other suggestions?
There are a couple of approaches here.
The first step is to remove the "testrb" command and swap it for a simple ruby command. For example, see http://pkgs.fedoraproject.org/cgit/rubygem-capillary.git/commit/?id=2bba5fe9...
. For capillary, that was enough to fix the build, because the test suite only used Minitest::Spec and didn't use Minitest::Unit at all.
If your gem uses Minitest::Unit then it can be a bit harder, and you'll need to port it to Minitest 5's syntax. Here's the four most common things I've run into when porting gems' test suites:
Rename all uses of "MiniTest::Unit::TestCase" to "Minitest::Test"
Change "require 'minitest/unit'" (or 'test/unit') to "require
'minitest/autorun'"
"assert_raise" functions should be renamed to "assert_raises"
"assert_not_foo" should be renamed to "refute_foo". For example,
the "assert_not_nil" function is gone in Minitest 5. It should be replaced with "refute_nil".
I've found that upstreams have been fairly receptive to patches that port to Minitest 5. So far svn2git, asciidoctor, resque-cleaner, geoip, literati and charlock_holmes have all accepted the pull requests for Minitest 5 support, and there are a couple of upstreams that are still reviewing the patches.
Even if you can't port the test suite yourself, it is still a good idea to raise the issue with upstream.
If you can't get the test suite to work, mtasaka has packaged minitest4 and it's available in Rawhide as a stop-gap until we can get everything ported over.
Interesting. There is possible to use BR: rubygem(minitest) < 5, which would pull in the rubygem-minitest which comes from ruby SRPM.
The last resort would be to disable the test suite during %check, but that's a last resort :) Even if you have to do this, at a minimum, it would be a good idea to put "BuildRequires: rubygem(minitest4)" so that we can all track this progress centrally using repoquery.
And several other notes:
- Be aware of packages which pulls in activesupport, which depends on
Minitest 5.x. For example rubygem-archivist is using the Ruby stdlib's test/unit, i.e. minitest 4.x, but in the same tame it pulls in activesupport and minitest 5.x. Of course this results in conflicts.
- We used this [1] monekypatch on several places. Not that I think it is
the best solution, but it might help temporary.
Interesting information. Could all this be documented somewhere in the wiki?
ruby-sig@lists.fedoraproject.org