beaker 4.37.2 → 4.38.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 94de428f52b80007b5443a3694bfba1c6cf8fb694373a760ba825d0b044117bb
4
- data.tar.gz: 0d28d5a725253b87ca396639767778f1a70d143094b94049a60616d7e7accd0d
3
+ metadata.gz: e1ac6690e4ad7436057320fe86b41db78a6f805e7fa93e1a5565ca84c778a5e0
4
+ data.tar.gz: 54cdf1e43fea24d2b1a1421612b12c9cc41cd9a529d00d78a79d37a6b746dadd
5
5
  SHA512:
6
- metadata.gz: 73f8ec5ae3893fe1b99b08515eac624b1531505c2793d507837a30e5bd0a6d87196fee04828d291e1c8bb1f2ab8dc3b158864270aa75a50d43a3759019ddbb94
7
- data.tar.gz: c81de7019a75a1532ec4ae1b52826c93bc3cfee7060ee52948c364be6ae50174177743bea06edd52b6cbd0866ed3d501d34c686bfe1c0e2c94ae9edfb4915a7b
6
+ metadata.gz: afe3ecdd06a58edf0a841aac2009eb0f03974edeaf4441d5843760dfa30e364be94c030c144173080abcdfc12f3b4b87dac1deaef6644e6cc56cc83297b51f2a
7
+ data.tar.gz: 5d7ec12ffce5318ca9470d9e66d689c6a9f51ef10fd29e5fa26d43bebcf47d6978d2f5d392a43223aba21f4d2372fe69994217adbaff73f4bb078a40a5633359
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.38.0](https://github.com/voxpupuli/beaker/tree/4.37.2) (2022-08-11)
4
+
5
+ ## Added
6
+
7
+ - Drop pry dependency, allow using debug gem ([#1737](https://github.com/voxpupuli/beaker/pull/1737))
8
+
3
9
  ## [4.37.2](https://github.com/voxpupuli/beaker/tree/4.37.2) (2022-07-28)
4
10
 
5
11
  ## Fixed
data/beaker.gemspec CHANGED
@@ -32,9 +32,6 @@ Gem::Specification.new do |s|
32
32
  # Run time dependencies
33
33
  s.add_runtime_dependency 'minitest', '~> 5.4'
34
34
  s.add_runtime_dependency 'minitar', '~> 0.6'
35
- s.add_runtime_dependency 'pry-byebug', '~> 3.9'
36
- # pry-byebug can have issues with native readline libs so add rb-readline
37
- s.add_runtime_dependency 'rb-readline', '~> 0.5.3'
38
35
  s.add_runtime_dependency 'rexml'
39
36
 
40
37
  s.add_runtime_dependency 'hocon', '~> 1.0'
@@ -1,6 +1,6 @@
1
1
  # Debug beaker tests
2
2
 
3
- beaker includes [pry-byebug](https://github.com/deivid-rodriguez/pry-byebug), a gem that combines two powerful related tools: pry and byebug
3
+ beaker can use [pry-byebug](https://github.com/deivid-rodriguez/pry-byebug), a gem that combines two powerful related tools: pry and byebug. It falls back to [debug](https://github.com/ruby/debug) if pry is unavailable.
4
4
 
5
5
  ### What is Pry?
6
6
 
@@ -16,6 +16,10 @@ There are several ways to have your tests break and enter debugging:
16
16
  2. [Use the --debug-errors option](#use-the---debug-errors-option)
17
17
  3. [Defining external breakpoints with byebug](#defining-external-breakpoints-with-byebug)
18
18
 
19
+ ### What is debug?
20
+
21
+ [debug](https://github.com/ruby/debug) is the new debugger bundled since Ruby 3.1.
22
+
19
23
  ## Add a breakpoint to your test file
20
24
 
21
25
  Add Pry to individual tests by adding `require 'pry'` to the Ruby test file. Then add the statement `binding.pry` at the point in code where you want access to the full, current Beaker environment.
@@ -232,7 +236,7 @@ Simply `exit` the console.
232
236
 
233
237
  ## Use the --debug-errors option
234
238
 
235
- You can run beaker and pass the option `--debug-errors` to have beaker enter the pry console if or when a test error occurs. This is useful for transient/intermittent errors where you may need to run the test a large number of times before seeing the failure. It's also useful to keep your hosts at the state where error occurred, as the test's teardown will not (yet) have executed.
239
+ You can run beaker and pass the option `--debug-errors` to have beaker enter the pry or debug console if or when a test error occurs. This is useful for transient/intermittent errors where you may need to run the test a large number of times before seeing the failure. It's also useful to keep your hosts at the state where error occurred, as the test's teardown will not (yet) have executed.
236
240
 
237
241
  ### Example
238
242
 
@@ -249,10 +253,10 @@ Consider this example test case _test.rb_, which is going to fail:
249
253
 
250
254
  You can run this test using `beaker -t test.rb` or (to use the `run` subcommand and just run the test and bypass host provisioning etc) `beaker run -t test.rb`. It fails.
251
255
 
252
- Now try `beaker run -t test.rb --debug-errors` This will enter a pry console when the failure occurs.
256
+ Now try `beaker run -t test.rb --debug-errors` This will enter a pry or debug console when the failure occurs.
253
257
 
254
258
  * Assert expected matches actual
255
- Exception raised during step execution and debug-errors option is set, entering pry. Exception was: #<Minitest::Assertion: This product is faulty.
259
+ Exception raised during step execution and debug-errors option is set, entering pry or debug. Exception was: #<Minitest::Assertion: This product is faulty.
256
260
  Expected: 3
257
261
  Actual: 2>
258
262
  HINT: Use the pry 'backtrace' and 'up' commands to navigate to the test code
@@ -31,7 +31,6 @@ module Beaker
31
31
  # end
32
32
  #
33
33
  module Structure
34
- require 'pry'
35
34
  # Provides a method to help structure tests into coherent steps.
36
35
  # @param [String] step_name The name of the step to be logged.
37
36
  # @param [Proc] block The actions to be performed in this step.
@@ -45,9 +44,22 @@ module Beaker
45
44
  end
46
45
  rescue Exception => e
47
46
  if(@options.has_key?(:debug_errors) && @options[:debug_errors] == true)
48
- logger.info("Exception raised during step execution and debug-errors option is set, entering pry. Exception was: #{e.inspect}")
49
- logger.info("HINT: Use the pry 'backtrace' and 'up' commands to navigate to the test code")
50
- binding.pry
47
+ begin
48
+ require 'pry'
49
+ rescue LoadError
50
+ begin
51
+ require 'debug'
52
+ rescue LoadError
53
+ logger.exception('Unable to load pry and debug while debug_errors was true')
54
+ else
55
+ logger.info("Exception raised during step execution and debug-errors option is set, entering debug. Exception was: #{e.inspect}")
56
+ binding.break
57
+ end
58
+ else
59
+ logger.info("Exception raised during step execution and debug-errors option is set, entering pry. Exception was: #{e.inspect}")
60
+ logger.info("HINT: Use the pry 'backtrace' and 'up' commands to navigate to the test code")
61
+ binding.pry
62
+ end
51
63
  end
52
64
  raise e
53
65
  end
@@ -1,5 +1,5 @@
1
1
  module Beaker
2
2
  module Version
3
- STRING = '4.37.2'
3
+ STRING = '4.38.0'
4
4
  end
5
5
  end
data/lib/beaker.rb CHANGED
@@ -38,11 +38,4 @@ module Beaker
38
38
 
39
39
  # MiniTest, for including MiniTest::Assertions
40
40
  require 'minitest/test'
41
-
42
- # Add pry support when available
43
- begin
44
- require 'pry'
45
- rescue LoadError
46
- # do nothing
47
- end
48
41
  end
@@ -1,4 +1,5 @@
1
1
  require 'spec_helper'
2
+ require 'readline'
2
3
 
3
4
  class ClassMixedWithDSLStructure
4
5
  include Beaker::DSL::Structure
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaker
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.37.2
4
+ version: 4.38.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-29 00:00:00.000000000 Z
11
+ date: 2022-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -108,34 +108,6 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0.6'
111
- - !ruby/object:Gem::Dependency
112
- name: pry-byebug
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: '3.9'
118
- type: :runtime
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: '3.9'
125
- - !ruby/object:Gem::Dependency
126
- name: rb-readline
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - "~>"
130
- - !ruby/object:Gem::Version
131
- version: 0.5.3
132
- type: :runtime
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - "~>"
137
- - !ruby/object:Gem::Version
138
- version: 0.5.3
139
111
  - !ruby/object:Gem::Dependency
140
112
  name: rexml
141
113
  requirement: !ruby/object:Gem::Requirement