File: Fix-require-calls-falling-in-autopkgtest.patch

package info (click to toggle)
ruby3.3 3.3.8-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 153,620 kB
  • sloc: ruby: 1,244,308; ansic: 836,474; yacc: 28,074; pascal: 6,748; sh: 3,913; python: 1,719; cpp: 1,158; makefile: 742; asm: 712; javascript: 394; lisp: 97; perl: 62; awk: 36; sed: 23; xml: 4
file content (109 lines) | stat: -rw-r--r-- 3,740 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
From: Lucas Kanashiro <kanashiro@ubuntu.com>
Date: Wed, 3 Jul 2024 00:40:33 -0300
Subject: Fix require calls falling in autopkgtest

---
 test/did_you_mean/helper.rb          | 28 ++++++++++++++++------------
 test/rdoc/support/test_case.rb       |  6 +++++-
 test/rdoc/test_rdoc_markdown.rb      |  9 +++++++--
 test/rdoc/test_rdoc_markdown_test.rb |  9 +++++++--
 4 files changed, 35 insertions(+), 17 deletions(-)

diff --git a/test/did_you_mean/helper.rb b/test/did_you_mean/helper.rb
index d40d58d..062548a 100644
--- a/test/did_you_mean/helper.rb
+++ b/test/did_you_mean/helper.rb
@@ -10,20 +10,24 @@ module DidYouMean
       end
     end
 
-    if File.file?(File.expand_path('../lib/did_you_mean.rb', __dir__))
-      # In this case we're being run from inside the gem, so we just want to
-      # require the root of the library
-
-      @root = File.expand_path('../lib/did_you_mean', __dir__)
-      require_relative @root
+    if ENV['AUTOPKGTEST_TMP']
+      require 'did_you_mean'
     else
-      # In this case we're being run from inside ruby core, and we want to
-      # include the experimental features in the test suite
+      if File.file?(File.expand_path('../lib/did_you_mean.rb', __dir__))
+        # In this case we're being run from inside the gem, so we just want to
+        # require the root of the library
+
+        @root = File.expand_path('../lib/did_you_mean', __dir__)
+        require_relative @root
+      else
+        # In this case we're being run from inside ruby core, and we want to
+        # include the experimental features in the test suite
 
-      @root = File.expand_path('../../lib/did_you_mean', __dir__)
-      require_relative @root
-      # We are excluding experimental features for now.
-      # require_relative File.join(@root, 'experimental')
+        @root = File.expand_path('../../lib/did_you_mean', __dir__)
+        require_relative @root
+        # We are excluding experimental features for now.
+        # require_relative File.join(@root, 'experimental')
+      end
     end
 
     def assert_correction(expected, array)
diff --git a/test/rdoc/support/test_case.rb b/test/rdoc/support/test_case.rb
index d98dbe0..e8e546f 100644
--- a/test/rdoc/support/test_case.rb
+++ b/test/rdoc/support/test_case.rb
@@ -13,7 +13,11 @@ require 'tempfile'
 require 'tmpdir'
 require 'stringio'
 
-require_relative '../../../lib/rdoc'
+if ENV['AUTOPKGTEST_TMP']
+  require 'rdoc'
+else
+  require_relative '../../../lib/rdoc'
+end
 
 ##
 # RDoc::TestCase is an abstract TestCase to provide common setup and teardown
diff --git a/test/rdoc/test_rdoc_markdown.rb b/test/rdoc/test_rdoc_markdown.rb
index dd6f312..b16780a 100644
--- a/test/rdoc/test_rdoc_markdown.rb
+++ b/test/rdoc/test_rdoc_markdown.rb
@@ -2,8 +2,13 @@
 # frozen_string_literal: true
 
 require_relative 'helper'
-require_relative '../../lib/rdoc/markup/block_quote'
-require_relative '../../lib/rdoc/markdown'
+if ENV['AUTOPKGTEST_TMP']
+  require 'rdoc/markup/block_quote'
+  require 'rdoc/markdown'
+else
+  require_relative '../../lib/rdoc/markup/block_quote'
+  require_relative '../../lib/rdoc/markdown'
+end
 
 class TestRDocMarkdown < RDoc::TestCase
 
diff --git a/test/rdoc/test_rdoc_markdown_test.rb b/test/rdoc/test_rdoc_markdown_test.rb
index d4f894c..0d6758c 100644
--- a/test/rdoc/test_rdoc_markdown_test.rb
+++ b/test/rdoc/test_rdoc_markdown_test.rb
@@ -2,8 +2,13 @@
 require_relative 'helper'
 require 'pp'
 
-require_relative '../../lib/rdoc'
-require_relative '../../lib/rdoc/markdown'
+if ENV['AUTOPKGTEST_TMP']
+  require 'rdoc'
+  require 'rdoc/markdown'
+else
+  require_relative '../../lib/rdoc'
+  require_relative '../../lib/rdoc/markdown'
+end
 
 class TestRDocMarkdownTest < RDoc::TestCase