File: 0001-specs-Use-require-instead-of-require_relative.patch

package info (click to toggle)
ruby-sequel 5.63.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 10,408 kB
  • sloc: ruby: 113,747; makefile: 3
file content (167 lines) | stat: -rw-r--r-- 6,120 bytes parent folder | download | duplicates (2)
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
From: Lucas Kanashiro <kanashiro@ubuntu.com>
Date: Wed, 7 Dec 2022 09:32:52 -0300
Subject: specs: Use 'require', instead of 'require_relative'

Upstream uses 'require_relative' within the specs. This makes running
the specs via autopkgtest fail, as lib/ is moved away during
autopkgtest runs.

Forwarded: no
Author: Georg Faerber <georg@riseup.net>
---
 spec/adapters/spec_helper.rb          |  2 +-
 spec/core/connection_pool_spec.rb     |  2 +-
 spec/core/database_spec.rb            | 16 +++++++++++-----
 spec/core/spec_helper.rb              |  4 ++--
 spec/core_extensions_spec.rb          |  2 +-
 spec/extensions/serialization_spec.rb |  2 +-
 spec/extensions/spec_helper.rb        |  2 +-
 spec/integration/spec_helper.rb       |  2 +-
 spec/model/spec_helper.rb             |  2 +-
 9 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/spec/adapters/spec_helper.rb b/spec/adapters/spec_helper.rb
index 048e294..38717ce 100644
--- a/spec/adapters/spec_helper.rb
+++ b/spec/adapters/spec_helper.rb
@@ -6,7 +6,7 @@ if ENV['COVERAGE']
 end
 
 $:.unshift(File.join(File.dirname(File.expand_path(__FILE__)), "../../lib/"))
-require_relative "../../lib/sequel"
+require "sequel"
 
 begin
   require_relative "../spec_config"
diff --git a/spec/core/connection_pool_spec.rb b/spec/core/connection_pool_spec.rb
index d2548e5..ddc69b2 100644
--- a/spec/core/connection_pool_spec.rb
+++ b/spec/core/connection_pool_spec.rb
@@ -1,5 +1,5 @@
 require_relative "spec_helper"
-require_relative '../../lib/sequel/connection_pool/sharded_threaded'
+require 'sequel/connection_pool/sharded_threaded'
 
 connection_pool_defaults = {:pool_timeout=>5, :max_connections=>4}
 st_connection_pool_defaults = connection_pool_defaults.merge(:single_threaded=>true)
diff --git a/spec/core/database_spec.rb b/spec/core/database_spec.rb
index 115afdb..323e48d 100644
--- a/spec/core/database_spec.rb
+++ b/spec/core/database_spec.rb
@@ -1675,7 +1675,7 @@ end
 
 describe "A Database adapter with a scheme" do
   before do
-    require_relative '../../lib/sequel/adapters/mock'
+    require 'sequel/adapters/mock'
     @ccc = Class.new(Sequel::Mock::Database)
     @ccc.send(:set_adapter_scheme, :ccc)
   end
@@ -1832,13 +1832,19 @@ end
 
 describe "A broken adapter (lib is there but the class is not)" do
   before do
-    @adapter = "blah#{$$}"
-    @fn = File.join(File.dirname(__FILE__), "../../lib/sequel/adapters/#{@adapter}.rb")
-    File.open(@fn,'a'){}
+    begin
+      @adapter = "blah#{$$}"
+      @fn = File.join(File.dirname(__FILE__), "../../lib/sequel/adapters/#{@adapter}.rb")
+      File.open(@fn,'a'){}
+    rescue Errno::ENOENT
+    end
   end
   
   after do
-    File.delete(@fn)
+    begin
+      File.delete(@fn)
+    rescue Errno::ENOENT
+    end
   end
   
   it "should raise an error" do
diff --git a/spec/core/spec_helper.rb b/spec/core/spec_helper.rb
index 7928773..b6b8b12 100644
--- a/spec/core/spec_helper.rb
+++ b/spec/core/spec_helper.rb
@@ -4,7 +4,7 @@ if ENV['COVERAGE']
 end
 
 $:.unshift(File.join(File.dirname(File.expand_path(__FILE__)), "../../lib/"))
-require_relative "../../lib/sequel/core"
+require "sequel/core"
 
 ENV['MT_NO_PLUGINS'] = '1' # Work around stupid autoloading of plugins
 gem 'minitest'
@@ -16,6 +16,6 @@ require_relative '../deprecation_helper'
 if ENV['SEQUEL_COLUMNS_INTROSPECTION']
   Sequel.extension :columns_introspection
   Sequel::Database.extension :columns_introspection
-  require_relative '../../lib/sequel/adapters/mock'
+  require 'sequel/adapters/mock'
   Sequel::Mock::Dataset.send(:include, Sequel::ColumnsIntrospection)
 end
diff --git a/spec/core_extensions_spec.rb b/spec/core_extensions_spec.rb
index ae15b78..2d2c987 100644
--- a/spec/core_extensions_spec.rb
+++ b/spec/core_extensions_spec.rb
@@ -4,7 +4,7 @@ if ENV['COVERAGE']
 end
 
 $:.unshift(File.join(File.dirname(File.expand_path(__FILE__)), "../lib/"))
-require_relative '../lib/sequel'
+require 'sequel'
 
 Regexp.send(:include, Sequel::SQL::StringMethods)
 String.send(:include, Sequel::SQL::StringMethods)
diff --git a/spec/extensions/serialization_spec.rb b/spec/extensions/serialization_spec.rb
index 232ecad..2c9471f 100644
--- a/spec/extensions/serialization_spec.rb
+++ b/spec/extensions/serialization_spec.rb
@@ -208,7 +208,7 @@ describe "Serialization plugin" do
 
   it "should handle registration of custom serializer/deserializer pairs" do
     @c.set_primary_key :id
-    require_relative '../../lib/sequel/plugins/serialization'
+    require 'sequel/plugins/serialization'
     Sequel::Plugins::Serialization.register_format(:reverse, proc{|s| s.reverse}, proc{|s| s.reverse})
     @c.plugin :serialization, :reverse, :abc, :def
     @c.dataset = @c.dataset.with_fetch(:id => 1, :abc => 'cba', :def => 'olleh')
diff --git a/spec/extensions/spec_helper.rb b/spec/extensions/spec_helper.rb
index 8a280c1..8421016 100644
--- a/spec/extensions/spec_helper.rb
+++ b/spec/extensions/spec_helper.rb
@@ -9,7 +9,7 @@ require 'minitest/global_expectations/autorun'
 require 'minitest/hooks/default'
 
 $:.unshift(File.join(File.dirname(File.expand_path(__FILE__)), "../../lib/"))
-require_relative "../../lib/sequel"
+require "sequel"
 
 require_relative "../visibility_checking_after_hook" if ENV['CHECK_METHOD_VISIBILITY']
 
diff --git a/spec/integration/spec_helper.rb b/spec/integration/spec_helper.rb
index ae0809a..9f314a0 100644
--- a/spec/integration/spec_helper.rb
+++ b/spec/integration/spec_helper.rb
@@ -6,7 +6,7 @@ if ENV['COVERAGE']
 end
 
 $:.unshift(File.join(File.dirname(File.expand_path(__FILE__)), "../../lib/"))
-require_relative "../../lib/sequel"
+require "sequel"
 
 require_relative "../visibility_checking" if ENV['CHECK_METHOD_VISIBILITY']
 
diff --git a/spec/model/spec_helper.rb b/spec/model/spec_helper.rb
index b3ef5f5..148ab19 100644
--- a/spec/model/spec_helper.rb
+++ b/spec/model/spec_helper.rb
@@ -1,5 +1,5 @@
 $:.unshift(File.join(File.dirname(File.expand_path(__FILE__)), "../../lib/"))
-require_relative "../../lib/sequel"
+require "sequel"
 
 Sequel::Deprecation.backtrace_filter = lambda{|line, lineno| lineno < 4 || line =~ /_spec\.rb/}