parallel_tests-extensions 0.0.1 → 0.1.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
  SHA1:
3
- metadata.gz: 688cc9a9ccce803da762d32f15f8df7be0be16f6
4
- data.tar.gz: 87c154d7f4b4bcc3b673bb37f0f1f7ee2881c553
3
+ metadata.gz: aae5fe7254f03e23113463cc6c87b899eb80db6e
4
+ data.tar.gz: bfcf4e0da4765feea937d2fb872568fd105e0171
5
5
  SHA512:
6
- metadata.gz: 49c2525ebe178be0322123a74c728af45038821382cc644f6f2d19beeb3e4266e574cb3609066b0d68d5e6db0b7e99a73891a60d57dc7219d3c81e33f159ab50
7
- data.tar.gz: 3b6e9ac392c266a521fd8629a57eb1280f306f05c59f680c8a67d1b3aeea04466291859973c07c2c7de5b2c016fae9906b2ba2e7f951ee4f6843f2f9c9df4f61
6
+ metadata.gz: 94f2cd80c46bf7f4f3342c625518349f8a6eded9876cbe25bffeb84e5375eb27abe8f866cd44b2bcd0ac44a5f9236435475726d7b9fafbe0a41a7b66a4b79a86
7
+ data.tar.gz: 9178a68e0cebb5c56bb67cf64097ff74c6f0b9954318d15b66552c9c007123ee099cf0b2c31122d1a42846a52f9a98b9159b19459b00b709e043babb0a6fcb7e
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ dummy/tmp
data/Gemfile CHANGED
@@ -2,3 +2,5 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in parallel_tests-extensions.gemspec
4
4
  gemspec
5
+
6
+ gem 'pry'
@@ -0,0 +1,8 @@
1
+ source :rubygems
2
+
3
+ gem 'parallel_tests'
4
+ gem 'minitest-reporters-parallel_tests_reporter'
5
+ gem 'minitest'
6
+ gem 'pry'
7
+ gem 'activesupport'
8
+ gem 'byebug'
@@ -0,0 +1,50 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ activesupport (4.2.4)
5
+ i18n (~> 0.7)
6
+ json (~> 1.7, >= 1.7.7)
7
+ minitest (~> 5.1)
8
+ thread_safe (~> 0.3, >= 0.3.4)
9
+ tzinfo (~> 1.1)
10
+ ansi (1.5.0)
11
+ builder (3.2.2)
12
+ byebug (8.2.1)
13
+ coderay (1.1.0)
14
+ i18n (0.7.0)
15
+ json (1.8.3)
16
+ method_source (0.8.2)
17
+ minitest (5.8.3)
18
+ minitest-reporters (1.1.7)
19
+ ansi
20
+ builder
21
+ minitest (>= 5.0)
22
+ ruby-progressbar
23
+ minitest-reporters-parallel_tests_reporter (0.0.1)
24
+ minitest-reporters
25
+ parallel (1.6.1)
26
+ parallel_tests (2.1.2)
27
+ parallel
28
+ pry (0.10.3)
29
+ coderay (~> 1.1.0)
30
+ method_source (~> 0.8.1)
31
+ slop (~> 3.4)
32
+ ruby-progressbar (1.7.5)
33
+ slop (3.6.0)
34
+ thread_safe (0.3.5)
35
+ tzinfo (1.2.2)
36
+ thread_safe (~> 0.1)
37
+
38
+ PLATFORMS
39
+ ruby
40
+
41
+ DEPENDENCIES
42
+ activesupport
43
+ byebug
44
+ minitest
45
+ minitest-reporters-parallel_tests_reporter
46
+ parallel_tests
47
+ pry
48
+
49
+ BUNDLED WITH
50
+ 1.10.6
@@ -0,0 +1,23 @@
1
+ $: << '../lib'
2
+
3
+ require 'parallel_tests'
4
+ require 'parallel_tests/extensions'
5
+
6
+ ParallelTests.after_tests do
7
+ ParallelTests.retry_failed_tests
8
+ end
9
+
10
+ require 'minitest/reporters/parallel_tests_reporter'
11
+
12
+ if ParallelTests.is_running?
13
+ Minitest::Reporters.use!(Minitest::Reporters::ParallelTestsReporter.new)
14
+ end
15
+
16
+ require 'minitest/autorun'
17
+ require 'minitest/spec'
18
+
19
+ class AlwaysFailingTest < Minitest::Spec
20
+ it 'always fails' do
21
+ assert false
22
+ end
23
+ end
@@ -0,0 +1,24 @@
1
+ $: << '../lib'
2
+
3
+ require 'parallel_tests'
4
+ require 'parallel_tests/extensions'
5
+
6
+ ParallelTests.after_tests do
7
+ ParallelTests.retry_failed_tests
8
+ end
9
+
10
+ require 'minitest/reporters/parallel_tests_reporter'
11
+
12
+ if ParallelTests.is_running?
13
+ Minitest::Reporters.use!(Minitest::Reporters::ParallelTestsReporter.new)
14
+ end
15
+
16
+ require 'minitest/autorun'
17
+ require 'minitest/spec'
18
+ require 'minitest/reporters/parallel_tests_reporter'
19
+
20
+ class AlwaysSuccessfulTest < Minitest::Spec
21
+ it 'always succeeds' do
22
+ assert true
23
+ end
24
+ end
@@ -0,0 +1,30 @@
1
+ $: << '../lib'
2
+
3
+ require 'parallel_tests'
4
+ require 'parallel_tests/extensions'
5
+
6
+ ParallelTests.after_tests do
7
+ ParallelTests.retry_failed_tests
8
+ end
9
+
10
+ require 'minitest/reporters/parallel_tests_reporter'
11
+
12
+ if ParallelTests.is_running?
13
+ Minitest::Reporters.use!(Minitest::Reporters::ParallelTestsReporter.new)
14
+ end
15
+
16
+ require 'minitest/autorun'
17
+ require 'minitest/spec'
18
+
19
+ class FailsEveryOtherTimeTest < Minitest::Spec
20
+ it 'always succeeds' do
21
+ file = 'touch.txt'
22
+ if File.exists?(file)
23
+ FileUtils.rm(file)
24
+ assert true
25
+ else
26
+ File.open(file, 'w') {|f| f.write ''}
27
+ fail
28
+ end
29
+ end
30
+ end
@@ -1,7 +1,57 @@
1
1
  require 'parallel_tests/extensions/version'
2
+ require 'active_support/core_ext/string/inflections'
3
+ require 'yaml'
4
+ require 'logger' # todo move to where used in m-r-ptr gem
2
5
 
3
6
  module ParallelTests
7
+ module Retries
8
+ def retry_failed_tests(ignore: nil)
9
+ # Hacky
10
+ if defined?(Minitest)
11
+ if first_process?
12
+ report = Minitest::Reporters::ParallelTestsReporter.compile_reports!
13
+ failed = report.select {|r| r[:failures].any?}
14
+ if failed.any?
15
+ puts "\nThe following tests failed:"
16
+ puts failed.map {|f| f[:location]}.join("\n")
17
+
18
+ puts "\nRe-running failed tests"
19
+ # TODO Doesn't work, this is a backtrace for where the exception occurred, what if we fail on setup?
20
+ found_all_test_files_for_failures = true
21
+ test_failures = failed.flat_map do |test|
22
+ guessed_test_name = test[:test_class_name].split('::').last
23
+ test_files = Dir["**/#{guessed_test_name.underscore}.rb"].entries
24
+ found_all_test_files_for_failures = false if test_files.empty?
25
+ test_files
26
+ end
27
+
28
+ test_files.reject! {|f| f[ignore]} if ignore
29
+
30
+ # hack
31
+ ENV.delete 'TEST_ENV_NUMBER'
32
+
33
+ # TODO fix and variablize
34
+ cmd = %Q{ruby -Ilib:test -e "#{test_failures.uniq.map {|f| "load '#{f}';"}.join("\n")}"}
35
+ puts cmd
36
+ did_pass = system cmd
37
+
38
+ if did_pass && found_all_test_files_for_failures
39
+ puts 'All tests passed on retry, marking build as success'
40
+ exit(0)
41
+ else
42
+ # use default messaging
43
+ end
44
+
45
+ # TODO parse output and print status
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+
4
52
  module Extensions
53
+ include Retries
54
+
5
55
  # @example
6
56
  # ParallelTests.is_running?
7
57
  # @return whether or not parallel test is running
@@ -1,5 +1,5 @@
1
1
  module ParallelTests
2
2
  module Extensions
3
- VERSION = '0.0.1'
3
+ VERSION = '0.1.0'
4
4
  end
5
5
  end
@@ -19,6 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_dependency 'parallel_tests'
22
+ spec.add_dependency 'activesupport'
22
23
 
23
24
  spec.add_development_dependency "bundler", "~> 1.10"
24
25
  spec.add_development_dependency "rake", "~> 10.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parallel_tests-extensions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Bodah
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-11-30 00:00:00.000000000 Z
11
+ date: 2015-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel_tests
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: activesupport
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: bundler
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -79,6 +93,11 @@ files:
79
93
  - Gemfile
80
94
  - README.md
81
95
  - Rakefile
96
+ - dummy/Gemfile
97
+ - dummy/Gemfile.lock
98
+ - dummy/always_failing_test.rb
99
+ - dummy/always_successful_test.rb
100
+ - dummy/fails_every_other_time_test.rb
82
101
  - lib/parallel_tests/extensions.rb
83
102
  - lib/parallel_tests/extensions/version.rb
84
103
  - parallel_tests-extensions.gemspec
@@ -106,4 +125,3 @@ signing_key:
106
125
  specification_version: 4
107
126
  summary: helper methods for working with parallel_tests
108
127
  test_files: []
109
- has_rdoc: