moto 1.0.0 → 1.0.1

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
  SHA1:
3
- metadata.gz: d2216e77b4bfad6cd5598a147586ed6567887fa0
4
- data.tar.gz: d8fc5dc3f9cbc7d86c6798ddf0d38225ed556cd9
3
+ metadata.gz: 6b4ceb470385c95d1e34d5907d3c055eb0e82d01
4
+ data.tar.gz: 9787f8dd894e7c2b00ac240646c019594d336a20
5
5
  SHA512:
6
- metadata.gz: 70c8d3fe2876552c6d14f8bdb8c547f68cde88c42fa791b184cbc72136d838adfb570899d2f39b3ba3ea81905acfcc25d1d519a72df7ac25613e8b99e5163b92
7
- data.tar.gz: c2fd5dbd5e26d38b14f608d64ddc7cfea677d6990f7f46781db86ce88369368b90f214e0ea2d8c1296383a20cb3075a9f19dced7be6c1fb818bfb69a7f6d6479
6
+ metadata.gz: 57029064fc0aac2f0cfb0a234268aac0916330bc1fae83727f08ed95349c0098113092453a93d29021b300a8c7cd968a3867b96be75df1c546adc77ab3c946e3
7
+ data.tar.gz: 9a0acf25d4ea66d626c48fefdb07abc121120c7c55b0ad697dba57882cdeed506f6d6938ccfc2d4edbf398b11640a3d4c5db7dc5596f702c46e8b03f57ba8bad
@@ -1,4 +1,3 @@
1
- require 'erb'
2
1
  require 'fileutils'
3
2
  require_relative '../../config'
4
3
 
@@ -82,7 +81,7 @@ module Moto
82
81
  file.chmod(0o666)
83
82
 
84
83
  Thread.current['logger'] = Logger.new(file)
85
- logger.level = config[:test_log_level] || Logger::DEBUG
84
+ logger.level = config[:log_level]
86
85
  end
87
86
 
88
87
  def logger
@@ -7,7 +7,7 @@ end
7
7
 
8
8
 
9
9
  require 'optparse'
10
-
10
+ require 'logger'
11
11
  require_relative 'config'
12
12
  require_relative 'modes/mode_selector'
13
13
 
@@ -65,7 +65,10 @@ module Moto
65
65
  opts.on('--stop-on-fail') {options[:stop_on][:fail] = true}
66
66
  opts.on('--stop-on-skip') {options[:stop_on][:skip] = true}
67
67
  opts.on('--dry-run') {options[:dry_run] = true}
68
- opts.on('-x', '--explicit_errors') {options[:explicit_errors] = true}
68
+ opts.on('-x', '--explicit-errors') {options[:explicit_errors] = true}
69
+ opts.on('--log-level LogLevel') {|v| options[:log_level] = v}
70
+ opts.on('--param-name ParamName') {|v| options[:param_name] = v}
71
+
69
72
  end.parse!
70
73
 
71
74
  if options[:tests]
@@ -87,11 +90,39 @@ module Moto
87
90
 
88
91
  Moto::Lib::Config.load_configuration(options[:config_name] ? options[:config_name] : 'moto')
89
92
 
93
+ if !Moto::Lib::Config.moto[:test_runner]
94
+ Moto::Lib::Config.moto[:test_runner] = {}
95
+ end
96
+
97
+ if !Moto::Lib::Config.moto[:test_generator]
98
+ Moto::Lib::Config.moto[:test_generator] = {}
99
+ end
100
+
101
+ # Runner configuration
102
+
90
103
  Moto::Lib::Config.moto[:test_runner][:thread_count] = options[:threads] if options[:threads]
91
104
  Moto::Lib::Config.moto[:test_runner][:test_attempt_max] = options[:attempts] if options[:attempts]
92
105
  Moto::Lib::Config.moto[:test_runner][:dry_run] = options[:dry_run] if options[:dry_run]
93
106
  Moto::Lib::Config.moto[:test_runner][:explicit_errors] = options[:explicit_errors] if options[:explicit_errors]
94
107
 
108
+ # Test log level parsing
109
+
110
+ if options[:log_level]
111
+ Moto::Lib::Config.moto[:test_runner][:log_level] = case options[:log_level].downcase
112
+ when 'info' then Logger::INFO
113
+ when 'warn' then Logger::WARN
114
+ when 'error' then Logger::ERROR
115
+ when 'fatal' then Logger::FATAL
116
+ else Logger::DEBUG
117
+ end
118
+ else
119
+ Moto::Lib::Config.moto[:test_runner][:log_level] = Logger::DEBUG
120
+ end
121
+
122
+ # Generator configuration
123
+
124
+ Moto::Lib::Config.moto[:test_generator][:param_name] = options[:param_name] if options[:param_name]
125
+
95
126
  return options
96
127
  end
97
128
 
@@ -220,13 +251,18 @@ module Moto
220
251
  --stop-on-error Moto will stop test execution when an error is encountered in test results
221
252
  --stop-on-fail Moto will stop test execution when a failure is encountered in test results
222
253
  --stop-on-skip Moto will stop test execution when a skip is encountered in test results
254
+
223
255
  --dry-run Moto will list all test cases which would be run with provided arguments
224
256
 
225
- --x, explicit_errors Use for development of tests - each code error in test will be caught,
257
+ --x, explicit-errors Use for development of tests - each code error in test will be caught,
226
258
  logged as would normally do but will be also additionaly re-thrown.
227
259
  This will obviously stop execution of selected set of tests but will provide
228
260
  full stack and error message to the developer.
229
261
 
262
+ --log-level Defines level at which Logger works. Use one of following: debug, info, warn, error, fatal.
263
+
264
+ --param-name Only parameters that contain provided string will be executed.
265
+
230
266
 
231
267
 
232
268
  ==============
@@ -39,9 +39,24 @@ module Moto
39
39
 
40
40
  # TODO CHANGED TEMPORARY
41
41
  #params_path = test_path_absolute.sub(/\.rb\z/, '')
42
- params_directory = File.dirname(test_metadata.test_path).to_s + '/params/**'
42
+ params_directory = File.dirname(test_metadata.test_path).to_s + '/params/'
43
+
44
+ # Depending on param_name being provided or not filter files in param directory in appropriate way
45
+ if config[:param_name]
46
+ params_directory << "*#{config[:param_name]}*.param"
47
+ else
48
+ params_directory << '*.param'
49
+ end
50
+
43
51
  param_files_paths = Dir.glob(params_directory)
44
- param_files_paths = [nil] if param_files_paths.empty?
52
+
53
+ # If param name is not specified then it's possible to run a test without params - they might not be there at all,
54
+ # but when param name is provided only matching ones need to be executed.
55
+ if config[:param_name]
56
+ param_files_paths = [] if param_files_paths.empty?
57
+ else
58
+ param_files_paths = [nil] if param_files_paths.empty?
59
+ end
45
60
 
46
61
  param_files_paths.each do |params_path|
47
62
 
@@ -61,7 +76,6 @@ module Moto
61
76
 
62
77
  variants
63
78
  end
64
-
65
79
  private :variantize
66
80
 
67
81
  # Generates test instances
@@ -106,6 +120,12 @@ module Moto
106
120
  test.injected_error_message = error_message
107
121
  end
108
122
 
123
+ # @return [Hash] Hash with config for test generator
124
+ def config
125
+ Moto::Lib::Config.moto[:test_generator]
126
+ end
127
+ private :config
128
+
109
129
  end
110
130
  end
111
131
  end
@@ -1,3 +1,3 @@
1
1
  module Moto
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moto
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bartek Wilczek
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2017-10-01 00:00:00.000000000 Z
14
+ date: 2017-10-10 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activesupport