commit:     129a4e3796095e0030dd59013b88810e73563f2f
Author:     Hans de Graaff <graaff <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 11 09:27:48 2021 +0000
Commit:     Hans de Graaff <graaff <AT> gentoo <DOT> org>
CommitDate: Thu Mar 11 09:31:31 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=129a4e37

dev-ruby/mustache: fix tests

Closes: https://bugs.gentoo.org/775371
Package-Manager: Portage-3.0.13, Repoman-3.0.2
Signed-off-by: Hans de Graaff <graaff <AT> gentoo.org>

 .../files/mustache-1.1.1-test-ordering.patch       | 36 ++++++++++++++++++++++
 dev-ruby/mustache/mustache-1.1.1.ebuild            |  6 ++--
 2 files changed, 40 insertions(+), 2 deletions(-)

diff --git a/dev-ruby/mustache/files/mustache-1.1.1-test-ordering.patch 
b/dev-ruby/mustache/files/mustache-1.1.1-test-ordering.patch
new file mode 100644
index 00000000000..824825bacbd
--- /dev/null
+++ b/dev-ruby/mustache/files/mustache-1.1.1-test-ordering.patch
@@ -0,0 +1,36 @@
+From 407c6a5db6c1f1cfb40bd6113f07f067d07885a4 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondr...@redhat.com>
+Date: Mon, 27 Apr 2020 11:16:17 +0200
+Subject: [PATCH] Fix test race condition.
+
+The test suite randomly fails with errors such as:
+
+~~~
+  1) Failure:
+AutoloadingTest#test_autoload_lowercase 
[/builddir/build/BUILD/mustache-1.1.1/usr/share/gems/gems/mustache-1.1.1/test/autoloading_test.rb:17]:
+Expected: Comments
+  Actual: nil
+~~~
+
+This happens when `test_namespaced*` test cases are executed earlier
+than the remaining test cases, because they are defining
+`view_namespace` but not cleaning up afterwards.
+---
+ test/autoloading_test.rb | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/test/autoloading_test.rb b/test/autoloading_test.rb
+index 0a7ad762..77eb3557 100644
+--- a/test/autoloading_test.rb
++++ b/test/autoloading_test.rb
+@@ -7,6 +7,10 @@ def setup
+     Mustache.view_path = File.dirname(__FILE__) + '/fixtures'
+   end
+ 
++  def teardown
++    Mustache.remove_instance_variable(:@view_namespace) if 
Mustache.instance_variable_defined?(:@view_namespace)
++  end
++
+   def test_autoload
+     klass = Mustache.view_class(:Comments)
+     assert_equal Comments, klass

diff --git a/dev-ruby/mustache/mustache-1.1.1.ebuild 
b/dev-ruby/mustache/mustache-1.1.1.ebuild
index 12424c6fe07..76e8a8f9ed8 100644
--- a/dev-ruby/mustache/mustache-1.1.1.ebuild
+++ b/dev-ruby/mustache/mustache-1.1.1.ebuild
@@ -1,9 +1,9 @@
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
 
-USE_RUBY="ruby24 ruby25 ruby26"
+USE_RUBY="ruby25 ruby26"
 
 RUBY_FAKEGEM_TASK_TEST=""
 
@@ -20,6 +20,8 @@ SLOT="0"
 KEYWORDS="amd64 arm ~arm64 ~hppa ppc ppc64 sparc x86 ~amd64-linux ~x86-linux 
~x64-macos ~x64-solaris"
 IUSE=""
 
+PATCHES=( "${FILESDIR}/${P}-test-ordering.patch" )
+
 ruby_add_bdepend "doc? ( app-text/ronn )"
 
 all_ruby_prepare() {

Reply via email to